Chartjs-How to intersect two different axis along the common axis on Chartjs?

0👍

To use both datasets as separate axes, you just need to map your data like this :

data : [
  {x:3598.599878, y:0.01},
  {x:3598.595369, y:0.03},
  {x:3598.580042, y:0.06},
  ...
]

Then in your options, make sure your X axis type is linear :

options : {
  scales:
    {x:
      { type:'linear', ...}
    }
}

This is because X axis type is category by default, and both your datasets are numeric, so after mapping, you will end up with only 1 dataset, and you can set the chart type to be line, bar or scatter.

Leave a comment