new Plot()
Generic base class for a plot which contains axes, data sources and series.
axes: Plots can have 2 or more axes. These can either be horizontal or vertical axes, and a multiple axes may exist for either direction. Axes for a plot are named. Their names are used in data series' options to identify which axes the series uses. Even though at least 2 axes definitions are required for scaling series, the axes may be hidden (set visible option to false).
sources: Plots can have multiple data sources, of different types. These sources are named, and their names used in data series' options to which source the series uses.
series: Plots can have multiple data series. These extract values from their data source, and plot the values along their dependent and independent axes.
- Source:
- To Do:
-
- format description
- Right now it's weird that some setters receive options, but return instances. I think I should separate options out as the instance's serialization, and then let users set/get instances as expected, but then separately serialize/deserialize instances based on passed options. Initial construction would still take an optional options object as the initial serialization.
Extends
Members
axes :Axis.Options
Set this value using an object of Axis.Options objects. Note that changing axes names may break some data series, which would then need to be updated as well.
Reading this value returns an object of Axis instances, instead of their options
Type:
- Source:
series :Series.Options
Set this value using an object of Series.Options objects.
Reading this value returns an object of Series instances, instead of their options
Type:
- Source:
sources :WebSocketJson.Options
Set this value using an object of WebSocketJson.Options objects. Note that changing source names may break some data series, which would then need to be updated as well.
Reading this value returns an object of Source instances, instead of their options
Type:
- Source:
title :String
Plot title
Type:
- String
- Source:
(inner) view
- Source:
- To Do:
-
- it's not cool that the data handler accesses the view's private members (_plotBody and _axisContainers). PlotBody should probably be pulled out into its own subelement, on the same level as view, and data and axes handlers. Unfortunately, there will be some view sizing issues to work out. I'm not sure how I'd refactor axisContainers right now, but there should be some consistency with plotBody
Methods
_rebuildLists()
Rebuild lists for this drawable and notify any parent drawable to do so as well. This ensures each drawable contains an updated, flat list of all the drawables beneath them. This way we save performance by not recursing through each child during draw time, and instead, drawing from the flat list at the level we care about.
- Inherited From:
- Source:
add(children)
Add a child drawable to this instance
Parameters:
Name | Type | Description |
---|---|---|
children |
Array.<Drawable> | Drawable | child drawables to add |
- Inherited From:
- Source:
remove(children)
Remove a child drawable from this instance
Parameters:
Name | Type | Description |
---|---|---|
children |
Array.<Drawable> | Drawable | child drawables to remove |
- Inherited From:
- Source:
Type Definitions
Options
These are the options specific to this class. Other options provided by Element.Options can also be passed to create a Plot.
Properties:
Name | Type | Description |
---|---|---|
axes |
Object | An object of Axis.Options objects. Object keys are axis names which can be used for modifying the plot after construction. |
sources |
Object | An object of WebSocketJson.Options objects. Object keys are source names which can be used for modifying data sources after construction. |
series |
Object | An object of Series.Options objects. Object keys are series names which can be used for modifying data series after construction. |
body |
PlotBody.Options | Options for the plot's body |
- Source: