Chart.js is a widely-used JavaScript library for creating modern charts for the web. It’s highly flexible and performant and can be used to create multiple types of charts. When you use the Chart.js custom visual type, your data is rendered using Chart.js’s Chart
class.
Demo
To view a quick demo of the custom Chart.js visual, use the Echo demo app referenced on the overview page to run the input below.
After running, you should see a Charts tab view on the run details view in Nextmv Console; clicking on this tab should display three demo charts.
Defining Chart.js data
This section covers the requirements for passing your Chart.js data for the custom visual asset to the content
property. The schema requirements for defining a custom visual asset can be found on the Overview page.
The Chart.js data that is passed to content
should be an array of objects with the following top-level properties:
Property | Description |
---|---|
| The type property defines which type of chart should be rendered. It must be one of Chart.js’s
The type defined here is passed to Chart.js’s type parameter when rendering the chart. |
data | The data used for rendering Chart.js charts. The data defined here is passed to Chart.js’s data parameter when rendering the chart. |
| (Optional) Settings defined in the You can override these default layout options by passing options of your own with the same names (all layout properties are Chart.js-specific, there are no Nextmv-specific layout options). However, it is not recommended to override the |
The custom data passed to content
will have this shape then:
Note that if multiple objects are included in the content
array then each object will be rendered as its own Chart.js chart. That is, you can render multiple Chart.js charts in a single custom view.