Home > database >  Adding an additional datasets to chartJS
Adding an additional datasets to chartJS

Time:06-07

I got this chart to create

bar chart to create in chartJS

I've successfully created the 2019 part with 5 points of colorful data inside. What I have so far:

enter image description here

I'm trying to add 2020 and 2021 data. Here's my code:

const DATA_COUNT = 3;
const NUMBER_CFG = {count: DATA_COUNT, min: 0, max: 70};

const labels = ['2019', '2020', '2021'];
const data = {
  labels: labels,
  datasets: [
    {
      label: 'AUD',
      data: ['51.01'],
      borderColor: '#3088E4',
      backgroundColor: '#3088E4',
    },
    {
      label: 'BEC',
      data: ['59.98'],
      borderColor: '#734C9D',
      backgroundColor: '#734C9D',
    },
    {
      label: 'FAR',
      data: ['46.31'],
      borderColor: '#4FA333',
      backgroundColor: '#4FA333',
    },
    {
      label: 'FAR',
      data: ['56.34'],
      borderColor: '#EC990F',
      backgroundColor: '#EC990F',
    },
    {
      label: 'Cumulative',
      data: ['53.41'],
      borderColor: '#999999',
      backgroundColor: '#999999',
    }
  ]
};

It can be tested live here, by pasting it under "Setup": enter image description here

  • Related