ChartJsView

Label: :IA_Function
Property: type: ChartJsView
Inherits from: Function and View

The ChartJsView Function renders a ChartJs with data.

Function parameters

Key Description Default value Possible values
chartType The type of chart gauge or one of the ChartJs types
data Data to use in the chart Array of objects
options Options to customize the charts. ChartJs options.
options.plugins.annotation Chart.js plugin that draws lines and boxes on the chart area. ChartJs annotation plugin.
options.plugins.datalables Chart.js plugin that adds (value) labels to chart elements ChartJs datalables plugin.
options.plugins.datalabels.display Should display datalables. This is the only option that is changed from the original default state. false Boolean, String or Function see docs
plugins One or more Chart.js plugins to register on the chart instance, e.g. custom plugin objects with lifecycle hooks. Multiple plugins are supported by providing an Array. Just like options, plugins (and each individual plugin in the Array) can be defined as a Function that returns the plugin(s), evaluated when the chart is rendered. Since Function values cannot use closures to reach the chart's data, each Function is called with (data, options, chartType) so the plugin can read the chart's current data/options/type directly from its arguments. A ChartJs plugin object, an Array of plugin objects, or a Function(data, options, chartType) returning either of these.

Outgoing triggers

Type: click

Occurrence: When the user selects a selectable item in the chart (depending on the chart type).

Additional event properties (besides the inherited properties):

Key Description Possible values
data Row data of the clicked element. object

* Example click data (for two datasets):

{
    companyA: {x: 3, y: 5.6, label: 'Company A'},
    companyB: {x: 3, y: 7.5, label: 'Company B'}
}