Local class
D4 locals allow you to define local state independent of data.
For instance, when rendering small multiples of time-series data, you might want the same x scale for all charts but distinct y scales to compare the relative performance of each metric. D4 locals are scoped by DOM elements: on set, the value is stored on the given element; on get, the value is retrieved from given element or the nearest ancestor that defines it.
Caution
Locals are rarely used; you may find it easier to store whatever state you need in the selection’s data.
Constructors
- Local()
- Declares a new local variable.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
get(
Node node) → JSAny? - Returns the value of this local on the specified node.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
Node node) → bool - Deletes this local’s value from the specified node.
-
set(
Node node, JSAny? value) → JSAny? - Sets the value of this local on the specified node to the value, and returns the specified value. This is often performed using selection.each:
-
toString(
) → String -
Returns the automatically-generated identifier for this local.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited