Skip to main content
Version: 8.1

Scriptable Options

Chart.js scriptable options are supported.

Any component property value containing an arrow function () => statement will be converted into a JavaScript function.

The function will have access to all parameters listed in the Chart.js documentation. See ChartJs Documentation - Scriptable Options for full details.

Scriptable Option Example

// Conditionally change the background color for a series depending on the y value.
// If the parsed y value is greater than 30 use red; otherwise, use blue.
// For non-data contexts (i.e. the color used for the legend), use green.
{
"datasets": [
{
"data": [...],
"label": "Dataset",
"backgroundColor": "(context) => { if (context.type == 'data') return context.parsed.y > 30 ? 'red' : 'blue'; else return 'green'; }"
}
]
}