Chartjs-Multiple y-axes using Chart JS with data as a dictionary

0πŸ‘

βœ…

In your object for your second dataset you define your object with a x and z key. Chart.js looks for an x and y key by default. If you want to change this and make chart.js look for different keys you need to configure that in the dataset like so:

{
  data: [{x:new Date('2022-10-21T00:00:00'),z:17.6},{x:new Date('2022-12-16T00:00:00'),z:16.9},{x:new Date('2023-01-20T00:00:00'),z:15.8}],
  parsing: {
    yAxisKey: 'z'
  }
}

Or you can change the key to y and that will also solve your issue

Leave a comment