The Chart.js helper plugin provides support for the Chart.js library. This plugin is best suited for use on mobile devices. For detailed information about Chart.js, see http://www.chartjs.org
Adding Chart.js to the Page Class
Adding Required Chart.js Files
Bear in mind that files are loaded in the order that they are listed in the parameters. If you also use the Dojo
2D Chart helper plugin, be sure to list the Chart.js library before the Dojo library in the JSINCLUDES
Registering the Chart.js Helper Plugin
The Chart.js helper plugin can be used with other page manager and helper plugins. If the Highcharts
helper plugin is also used, some plugin conflicts will occur (see Chart.js Layout Objects
in the following section for details).
Other Options and Requirements
Using Chart.js in a Template Class
Chart.js Layout Objects
displays a chart specified by type ($barchart
by default). The other layout objects display specific chart types:
Custom Chart.js Layout Object Methods
The following methods are available within all appropriate layout objects:
Re-renders the HTML for the layout object.
Chart.js Helper Plugin Methods
Direct Access to the Chart.js Library
This plugin does not provide direct access to Chart.js library functions.
Custom Chart.js Helper Plugin Methods
Adds data to the chart specified by key
. The labelOrIndex
parameter is expected to be a dataset index in doughnut, pie, and polar charts.
Removes data from the chart specified by key
. The index
parameter only applies to doughnut, pie, and polar chart types. If index
is not specified for those chart types, the last data element is removed. The other chart types simply remove the first variable.
Updates and re-renders the chart specified by key
The chart is driven by the value
data object. The value
argument passed to onselect()
is an array returned by a Chart.js library prototype method of the chart instance, and has a structure that varies according to the chart type:
The Widget Reference
offers interactive widget samples for the Chart.js helper. The reference includes working examples, detailed descriptions, and source code that you can cut and paste into your own applications.