Class
caplin.chart.highchart

SeriesUtility

A utility class to manage some common operations on a HighChart series object.

Constructor Summary

Attributes Name and Description
caplin.chart.highchart.SeriesUtility(Object highChartSeries)

Constructs a new caplin.chart.highchart.SeriesUtility.

Method Summary

Attributes Name and Description
Boolean addTicks(Array periods, Function completionCallback)

Adds periods to a HighChart series.

Object|null|undefined getPointByTimestamp(Number timestamp)

Finds a HighChart point object based on the timestamp.

Boolean setPointValue(Object periodData)

Adds a new point to a series or updates an existing one if it is already present on the series.

Constructor Detail

caplin.chart.highchart.SeriesUtility(Object highChartSeries)

Constructs a new caplin.chart.highchart.SeriesUtility.

Parameters
Object highChartSeries A HighChart series object.

Method Detail

Boolean addTicks(Array periods, Function completionCallback)

Adds periods to a HighChart series.

Parameters
Array periods An array of periods in the Caplin chart format.
Function completionCallback A function that runs once the periods have been processed.
Returns
{Boolean} Returns true if the chart needs to be redrawn after calling this method, false otherwise.

Object|null|undefined getPointByTimestamp(Number timestamp)

Finds a HighChart point object based on the timestamp.

Note that if dataGrouping is enabled, or if the chart is zoomed or panned so that it's not showing the point being searched for, this won't return the Point object, even if it was returned in one of the previous calls to this method.

Parameters
Number timestamp The timestamp to searh for.
Returns
{Object|null|undefined} If the Point object is found it will return it. If the HighChart series already has a period with this timestamp, but hasn't yet created the Point object undefined will be returned. If however the timestamp is part of a new period, null will be returned.

Boolean setPointValue(Object periodData)

Adds a new point to a series or updates an existing one if it is already present on the series.

Parameters
Object periodData A series period data in the Caplin chart format.
Returns
{Boolean} Returns true if the chart needs to be redrawn after calling this method, false otherwise.