Our charting library has been designed primarily to interface with the Caplin Platform via StreamLinkJS to retrieve chart series data and relay that data to the OEM licensed chart rendering engine Highstock or HighChart. In its default configuration, series data can be retrieved from available platform services - the JavaChartingService for historic RMDS source data (daily, weekly or monthly intervalisation periods) and the IntraDay Chart module for periods of less than 1 day (fully configurable).
However, this pipeline can be customised at well-defined points to suit your particular environment's setup.
The Chart Service provides the the mechanism to get data from your back end. If you are getting series data from the platform, there's nothing you need to configure, you can just create a chart and it will use this service.
If the provided platform services do not suit your requirements, you can implement a chart data service that retrieves data from your existing data sources (e.g. a webservice), or to translate retrieved series data into an alternate format for usage by your preferred rendering engine.
Swapping out the default implementation is simply a matter of creating a new class that implements the caplin.chart.service.ChartService interface and then defining an alias mapping in your application's default aspect aliases.xml file:
<alias name="caplin.chart-service" class="novox.chart.service.MyChartService"/>
SeriesRequest contains properties that define the series that will be presented on the resultant chart. You create one and pass it to a
Series that you are going to request.
The primary purpose of the
Series class is to offer provisions for client-side derivations (Studies) that can be run against existing chart data. Each
Series instance maintains a cache of the retrieved point data in the form:
[ [utc_timestamp, open, high, low, close(, volume)], ... ]
This cache is used as source data for any Study that is added to the chart without having to go to the server again. The chosen cache format matches that used by Highstock, making it convenient to render OHLC and candlestick series representations.
If an alternate chart engine is preferred over Highstock or a simpler series representation is required (e.g. a simple time value spline), the output of the Series instance can be modified by providing an adaptor during construction.
... = new caplin.chart.Series(oSeriesRequest, oListener, oChartSeriesAdaptor);
See the "Write a chart component" tutorial for further information on how a series can be retrieved and rendered.
A number of common studies have been added to the Caplin chart libraries to get you started:
|Simple Moving Average||caplin.chart-sma-study|
|Exponential Moving Average||caplin.chart-ema-study|
These studies are ready to be used in your own chart component, or if preferred, an alternative alias mapping can be defined to swap out the default implementation with your own.
Class Architecture (UML)