]>
git.argeo.org Git - gpl/argeo-suite.git/blob - js/src/chart/ChartJsPart.js
1 import ChartPart
from './ChartPart.js';
3 import { Chart
} from 'chart.js';
4 import annotationPlugin
from 'chartjs-plugin-annotation';
6 Chart
.register(annotationPlugin
);
8 export default class ChartJsPart
extends ChartPart
{
11 /** Constructor taking the mapName as an argument. */
12 constructor(chartName
) {
28 const chart
= this.getChart();
29 chart
.data
.labels
= labels
;
33 addDataset(label
, data
) {
34 const chart
= this.getChart();
35 chart
.data
.datasets
.push({
43 setData(labels
, label
, data
) {
45 this.setLabels(labels
);
46 this.addDataset(label
, data
);
49 setDatasets(labels
, datasets
) {
50 const chart
= this.getChart();
51 chart
.data
.datasets
= datasets
;
52 chart
.data
.labels
= labels
;
57 const chart
= this.getChart();
58 chart
.data
.datasets
= [];