[Chartjs]-How can I implement a custom dataset data structure for a Line Chart.js?

1๐Ÿ‘

โœ…

As described in the docs here you can pass your own custom datatype:

import {ChartData} from 'chart.js';

const datasets: ChartData<'bar', {key: string, value: number} []> = {
  datasets: [{
    data: [{key: 'Sales', value: 20}, {key: 'Revenue', value: 10}],
    parsing: {
      xAxisKey: 'key',
      yAxisKey: 'value'
    }
  }],
};

Leave a comment