Class: DataSeriesPlot

org.bodytrack.grapher.DataSeriesPlot(plotId, datasource, dateAxis, yAxis, styleopt, isLocalTimeopt)

new DataSeriesPlot(plotId, datasource, dateAxis, yAxis, styleopt, isLocalTimeopt)

Wrapper class to make it easier to work with a DataSeriesPlot.
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
dateAxis org.bodytrack.grapher.DateAxis the date axis
yAxis org.bodytrack.grapher.YAxis the Y axis
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).
Source:

Methods

addDataPointListener(listener)

Adds the given function as a data point listener. Does nothing if the given listener is not a function.
Parameters:
Name Type Description
listener dataPointListenerFunction function for handling a DataPoint event.
Source:

getClosestDataPointToTimeWithinWindow(timeInSecs, numSecsBefore, numSecsAfter) → {DataPoint|null}

Returns the closest DataPoint in this plot to the given timeInSecs, within the window of time [timeInSecs - numSecsBefore, timeInSecs + numSecsAfter]. Returns null if no point exists in the time window.
Parameters:
Name Type Description
timeInSecs the time, in seconds, around which the window of time to look for the closest point is defined
numSecsBefore when defining the time window in which to look for the closest point, this is the number of seconds before the timeInSecs
numSecsAfter when defining the time window in which to look for the closest point, this is the number of seconds after the timeInSecs
Source:
Returns:
Type
DataPoint | null

getId() → {string|number}

Returns the plot's ID.
Source:
Returns:
Type
string | number

getStatisticsWithinRange(rangeOrMinTimeSecs, maxTimeSecsopt) → {PlotStatistics}

Gets statistcs about the data within the specified time range. Note that some implementations may limit the time range for the statistics to the current visible date range.
Parameters:
Name Type Attributes Description
rangeOrMinTimeSecs AxisRange | number an AxisRange or a double representing the time in Unix time seconds of the start of the visible time range. If null, undefined, non-numeric, or not an AxisRange, then -1*Number.MAX_VALUE is used instead.
maxTimeSecs number <optional>
a double representing the time in Unix time seconds of the end of the visible time range. If null, undefined, or non-numeric, then Number.MAX_VALUE is used instead.
Source:
Returns:
Type
PlotStatistics

getStyle() → {Object}

Returns the plot's current style.
Source:
Returns:
the style
Type
Object

getWrappedPlot() → {DataSeriesPlot}

Returns the wrapped DataSeriesPlot object.
Source:
Returns:
Type
DataSeriesPlot

removeDataPointListener(listener)

Removes the given data point listener. Does nothing if the given listener is not a function.
Parameters:
Name Type Description
listener dataPointListenerFunction function for handling a DataPoint event.
Source:

setCursorColor(colorDescriptor)

Sets the plot's cursor 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:

setStyle(the)

Sets the plot's style.
Parameters:
Name Type Description
the Object style
Source: