Class pvc.visual.Scene
Constructor Attributes | Constructor Name and Description |
---|---|
The Scene class represents a single point rendered by Protovis marks.
|
Field Attributes | Field Name and Description |
---|---|
Business Data | |
Gets the atoms map of the scene's first data set or first datum.
|
|
Gets the first datum represented by the scene,
when there is at least one, or null, otherwise.
|
|
Gets the atoms map of the scene's first datum.
|
|
Gets the first data set represented by the scene,
when there is at least one, or null, otherwise.
|
|
Gets the array of data sets represented by the scene,
when there is at least one, or null, otherwise.
|
|
DOM | |
The array of child scenes.
|
|
The first child scene.
|
|
The last child scene.
|
|
The next sibling scene.
|
|
The parent scene.
|
|
The previous sibling scene.
|
|
The root scene.
|
|
Interactivity - Active | |
Gets a value that indicates if the scene is in an active state.
|
|
Visual Data | |
Gets the variables map of the scene.
|
Method Attributes | Method Name and Description |
---|---|
Business Data | |
datums()
Returns an enumerable of all of the represented pvc.data.Datum.
|
|
DOM | |
Gets the index of this scene in relation to its sibling scenes.
|
|
children()
An enumerable of the child scenes.
|
|
isRoot()
Gets a value that indicates if this scene is a root scene.
|
|
leafs()
An enumerable of the leaf scenes.
|
|
Interactivity | |
Gets a value that indicates if the scene is in an interactive state.
|
|
Interactivity - Active | |
active()
Gets the active scene of the scene tree to which this scene belongs.
|
|
Gets the value of the series variable of the active scene,
if any, of the scene tree to which this scene belongs.
|
|
Gets a value that indicates if the tree to which this scene belongs has an active scene.
|
|
Clears the active scene of this scene's tree, if any.
|
|
Gets a value that indicates if this scene's series is active.
|
|
setActive(active)
Sets this scene as the active scene of its scene tree.
|
|
Interactivity - Selected | |
Gets a value that indicates if any datum is selected.
|
|
Gets a value that indicates if at least one of the datums represented by the scene is selected.
|
|
Visual Components | |
chart()
Gets the immediate chart instance.
|
|
panel()
Gets the immediate panel instance.
|
|
Visual Data | |
Gets the value of the category scene variable (defined in scenes of categorical and pie plots).
|
|
Gets the label of the category scene variable.
|
|
getColor()
Gets the value of the color scene variable (defined in scenes of plots).
|
|
Gets the label of the color scene variable.
|
|
Gets the value of the series scene variable (defined in scenes of cartesian plots).
|
|
Gets the label of the series scene variable.
|
|
getSize()
Gets the value of the size scene variable (defined in scenes of the heat-grid and the scatter/metric-point plots).
|
|
Gets the label of the size scene variable.
|
|
getTick()
Gets the value of the tick scene variable (defined in scenes of the cartesian axis).
|
|
Gets the label of the tick scene variable.
|
|
getValue()
Gets the value of the value scene variable (defined in scenes of categorical/numeric plots and the legend panel).
|
|
Gets the label of the value scene variable.
|
|
getX()
Gets the value of the x scene variable (defined in scenes of the scatter/metric-point plot).
|
|
Gets the label of the x scene variable.
|
|
getY()
Gets the value of the y scene variable (defined in scenes of the scatter/metric-point plot).
|
|
Gets the label of the y scene variable.
|
However, a scene is not specific to a given mark, and may actually feed several of them (a pv.Dot, a pv.Line and an pv.Area).
Scenes provide a well defined interface to CCC extension point functions.
Scenes contain participating datums and vars.
When the scene represents data sets, gets the {pvc.data.Complex#atoms} map of #group. Otherwise, when the scene directly represents datums, gets the {pvc.data.Complex#atoms} map of #datum. Ultimately, gets an empty map.
Note that when the scene represents one or more data sets, its atoms map will generally not contain an pvc.data.Atom for each dimension, but instead will only contain an atom for each dimension in which all of the scene's datums have the same value (ensured due to a group by operation having been performed). Contrast this with #firstAtoms.
Use atoms when you need access to the business data that is common to all datums that are represented in a scene. You'll typically only use this for interfacing with external components. For internal use, it's usually best to use #vars, which expose "visual data".
Example pvc.options.charts.BasicChart#clickAction handler, accessing the value of the "productFamily" dimension:
function(scene) {
window.alert("Clicked on: " + scene.atoms.productFamily.value);
}
- See:
- #datums
- #vars
- #firstAtoms
A scene may visually represent a single datum, a series of datums, a single data set or a series of data sets. In any case, this property contains the first datum.
- See:
- #datums
When the scene represents at least one datum, gets its pvc.data.Complex#atoms map. Ultimately, gets an empty map.
A scene may visually represent a single datum, a series of datums, a single data set or a series of data sets.
A scene may visually represent a single datum, a series of datums, a single data set or a series of data sets.
This array is empty for leaf scenes. An easy way to check if child scenes exist is to query #firstChild.
- See:
- #children
This is is null for leaf scenes.
This is is null for leaf scenes.
This is null for the last child scene.
This is null for root scenes.
This is null for the first child scene.
- See:
- #isRoot
A scene becomes active while the user hovers-over any of the the visual elements that represent it.
Each chart and plot visual role usually has a corresponding scene variable with its name. Just like with atoms, a scene variable contains the properties value and label.
Use it to obtain the value of a visual role, like, for example: scene.vars.series.value.
In the scene trees of some panels, such as the legend panel and the cartesian axes panels, scene variables are not named after the corresponding plot visual role. This is because they can show information which comes from more than one plot visual role.
In the discrete color legend panel, the main variable is named value.
In cartesian axes panels, the main variable is named tick.
In the following example, a mark's fillStyle extension point is calculated based on the value of the category variable:
function(scene) {
switch(scene.vars.category.value) {
case "cars": return "red";
case "plains": return "green";
case "boats": return "blue";
}
return "orange";
}
In the following example, the pvc.options.charts.BasicChart#clickAction handler is used to display to the user the category variable's label of the clicked-on scene:
function(scene) {
window.alert("The category is: " + scene.vars.category.label);
}
When the scene represents no datums, an empty enumerable is returned.
- Returns:
- {!def.Query} An enumerable of pvc.data.Datum.
This index is 0-based.
When the node is a root node, -1 is returned.
- Returns:
- {number} The child index.
- See:
- #childNodes
- #leafs
- Returns:
- {boolean} true if the scene is a root scene; false otherwise.
- See:
- #root
- See:
- #children
A scene is in an interactive state if it is active, #isActive and/or if it represents at least one datum which is selected.
- Returns:
- {boolean} true if the scene is in an interactive state; false otherwise.
- Returns:
- {pvc.visual.Scene} The active scene, if any; null, otherwise.
- Returns:
- {any} The active series value.
A scene becomes active while the user hovers-over any of the the visual elements that represent it.
- Returns:
- {boolean} true if there is an active scene; false otherwise.
This scene may not be the active scene.
- Returns:
- {boolean} `true` if the scene tree's active scene changed, `false`, otherwise.
A scene's series is said to be active if it has a series variable and it has the same value as that returned by #activeSeries.
- Returns:
- {boolean} true if this scene's series is active; false otherwise.
When a scene is activated, any previously active scene of the same scene tree is deactivated. To update the chart, you should also execute this.panel().renderInteractive().
- Arguments:
- {boolean} active Optional, Default: false
- The new active state of the scene.
- Returns:
- {boolean} true if there is any selected datum; false, otherwise.
- Returns:
- {boolean} true if there is one selected datum; false otherwise.
In multi-chart scenarios, this is the chart that is closest to where the scene belongs.
To be sure to get the root chart, get its pvc.BaseChart#root property.
- Returns:
- {!pvc.BaseChart} The chart instance.
This is the panel that is closest to where the scene belongs. Ultimately, this is the root chart's base panel.
- Returns:
- {!pvc.BasePanel} The panel instance.
This method is sugar for scene.vars.category.value.
- Returns:
- {any} The variable's value.
- See:
- #getCategoryLabel
This method is sugar for scene.vars.category.label.
- Returns:
- {any} The variable's label.
- See:
- #getCategory
This method is sugar for scene.vars.color.value.
This is not a color value (like a color string or a pv.Color object), but, instead, the business value that is passed to a color scale to obtain a color.
- Returns:
- {any} The variable's value.
- See:
- #getColorLabel
This method is sugar for scene.vars.color.label.
- Returns:
- {any} The variable's label.
- See:
- #getColor
This method is sugar for scene.vars.series.value.
- Returns:
- {any} The variable's value.
- See:
- #getSeriesLabel
This method is sugar for scene.vars.series.label.
- Returns:
- {any} The variable's label.
- See:
- #getSeries
This method is sugar for scene.vars.size.value.
- Returns:
- {any} The variable's value.
- See:
- #getSizeLabel
This method is sugar for scene.vars.size.label.
- Returns:
- {any} The variable's label.
- See:
- #getSize
This method is sugar for scene.vars.tick.value.
- Returns:
- {any} The variable's value.
- See:
- #getTickLabel
This method is sugar for scene.vars.tick.label.
- Returns:
- {any} The variable's label.
- See:
- #getTick
This method is sugar for scene.vars.value.value.
- Returns:
- {any} The variable's value.
- See:
- #getValueLabel
This method is sugar for scene.vars.value.label.
- Returns:
- {any} The variable's label.
- See:
- #getValue
This method is sugar for scene.vars.x.value.
- Returns:
- {any} The variable's value.
- See:
- #getXLabel
This method is sugar for scene.vars.x.label.
- Returns:
- {any} The variable's label.
- See:
- #getX
This method is sugar for scene.vars.y.value.
- Returns:
- {any} The variable's value.
- See:
- #getYLabel
This method is sugar for scene.vars.y.label.
- Returns:
- {any} The variable's label.
- See:
- #getY