Mike Bostock edited this page Apr 16, 2013 · 9 revisions

WikiAPI ReferenceCube

A source for Cube metrics. To create a source, first create a context. Then, use context.cube to specify the URL of the Cube evaluator. For example:

var context = cubism.context(), // a default context
    cube = context.cube("");

# cube.metric(expression)

Creates a new metric for the given Cube expression. For example, if you were using Cube to collect "request" events, you could query the number of request events by saying:

var requests = cube.metric("sum(request)");

For more information on metric expressions, see Cube's documentation.

# cube.toString()

Returns the URL of the Cube server; the first argument to the constructor.