Skip to content
mbostock edited this page Apr 21, 2012 · 5 revisions

WikiAPI ReferenceRule

A thin vertical line that updates on mousemove. This is typically used to indicate the context's focus value. To create a rule, first create a context. For example:

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

# rule(selection)

Apply the rule to a D3 selection or transition containing one or more SVG element. For example:

d3.select("body").append("div")
    .attr("class", "rule")
    .call(rule);

# rule.remove(selection)

Removes the rule from a D3 selection, and removes any associated listeners. This method only removes the contents added by the rule itself; typically, you also want to call remove on the selection. For example:

d3.select(".rule")
    .call(rule.remove)
    .remove();

Requires that the elements in the selection were previously bound to this rule.

Clone this wiki locally