0

Sample Chart

Say I have a chart here with 5 y-axes, I would like to know if it's possible to combine axes that are close to each other, at least 20% difference. Like 1.2m and 1.0m axes, there's 20% difference between them, hence I want them to combine into 1 and assign the corresponding plots to that combined axis.

3.5k and 4.0k would also ideally be combined if they will conform with the 20% diff threshold. On the other hand, 120k axis would be on its own since it has no axes close to its value.

I tried creating a custom logic to group them together but it I got lost pointing the plots to the combined versions. If this is not possible with ChartJS, I would gladly accept.

Tony Stonks
  • 360
  • 3
  • 13
  • 1
    Not sure if I got your point. I think you have set the yAxisID to your datasets. The value could be the result of your logic, where you can compare the max value of the datasets. here the value is less than 20%, you could set the same scale. Then you could set the display option of the scales as scriptable (i.e. display: () => false,) where you hide the scales not related to any datasets. – user2057925 Oct 27 '22 at 11:43
  • Thank you for this. I got insight on how to utilize the yAxisID + the scriptable display of axes. Also, there's an option display: 'auto' on axis options to automatically hide them when no datapoint is anchored to it. Very helpful! – Tony Stonks Oct 28 '22 at 06:29

0 Answers0