new PlotContainer(elementId, dateAxis)
Wrapper class to make it easier to work with a plot container.
Parameters:
| Name | Type | Description |
|---|---|---|
elementId |
string | the DOM element ID for the container div holding this plot container |
dateAxis |
org.bodytrack.grapher.DateAxis | the date axis |
- Source:
Methods
addDataSeriesPlot(plotId, datasource, yAxisElementId, minValueopt, maxValueopt, styleopt, isLocalTimeopt, yAxisRangePaddingStrategyFunctionopt)
Adds a data series plot to the plot container. The plot will be associated with the Y axis specified by the
given
yAxisElementId (the Y axis may be shared with other plots, if you wish).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
plotId |
string | number | A identifier for this plot, unique within the PlotContainer. Must be a number or a string. | ||
datasource |
datasourceFunction | function with signature function(level, offset, successCallback) resposible for returning tile JSON for the given level and offset |
||
yAxisElementId |
string | the DOM element ID for the container div holding this plot's Y axis | ||
minValue |
number |
<optional> |
0 | the minimum initial value for the Y axis (if the Y axis is created for this plot). Defaults to 0 if undefined, null, or non-numeric. |
maxValue |
number |
<optional> |
100 | the maximum initial value for the Y axis (if the Y axis is created for this plot). Defaults to 100 if undefined, null, or non-numeric. |
style |
Object |
<optional> |
the style object. A default style is used if undefined, null, or not an object. | |
isLocalTime |
boolean |
<optional> |
false | whether the plot's data uses local time. Defaults to false (UTC). |
yAxisRangePaddingStrategyFunction |
yAxisRangePaddingStrategyFunction |
<optional> |
Y axis range padding strategy function. Defaults to the default padding strategy. |
- Source:
getElementId() → {string}
Returns the DOM element ID for the container div holding this plot container.
- Source:
Returns:
- Type
- string
getPlot(plotIdopt) → {org.bodytrack.grapher.DataSeriesPlot}
Returns the YAxis with the specified
plotId. Returns
null if no such plot exists. If the given plotId is undefined or null,
this method returns the first plot found, or null if none have been added.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
plotId |
string | number |
<optional> |
A identifier for the plot, unique within the PlotContainer. Must be a number or a string. |
- Source:
Returns:
getYAxis(yAxisElementIdopt) → {org.bodytrack.grapher.YAxis}
Returns the YAxis for the specified DOM element ID. Returns
null if no such axis exists. If the given yAxisElementId is undefined or null,
this method returns the first Y axis found, or null if none have been added.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
yAxisElementId |
string |
<optional> |
the DOM element ID for the container div holding the desired Y axis |
- Source:
Returns:
removeAllPlots()
Removes all plots from this PlotContainer.
- Source:
removePlot(plotId)
Removed the plot with the given
plotId from this PlotContainer.
Parameters:
| Name | Type | Description |
|---|---|---|
plotId |
string | number | A identifier for the plot to remove, unique within the PlotContainer. Must be a number or a string. |
- Source:
setAutoScaleEnabled(isEnabled, isPaddingEnabledopt)
Sets whether autoscaling and autoscale padding are enabled, if supported by the underlying grapher; otherwise does nothing.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
isEnabled |
boolean | whether autoscale is enabled. | |
isPaddingEnabled |
boolean |
<optional> |
whether padding of the autoscaled Y axis is enabled; ignored if
isEnabled is false. Defaults to false if undefined or null. |
- Source:
setCursorColor(colorDescriptor)
Sets the cursor for each contained plot to the color described by the given
colorDescriptor, or to
black if the given colorDescriptor is undefined, null, or invalid. The color
descriptor can be any valid CSS color descriptor such as a word ("green", "blue", etc.), a hex color
(e.g. "#ff0000"), or an RGB color (e.g. "rgb(255,0,0)" or "rgba(0,255,0,0.5)").
Parameters:
| Name | Type | Description |
|---|---|---|
colorDescriptor |
string | a string description of the desired color. |
- Source:
setHeight(height)
Sets the height of the PlotContainer and all of its Y axes to the given height.
Parameters:
| Name | Type | Description |
|---|---|---|
height |
int | the new height |
- Source:
setWidth(width)
Sets the width of the PlotContainer.
Parameters:
| Name | Type | Description |
|---|---|---|
width |
int | the new width |
- Source: