Implement muti Y axis on QT chart?

532 Views Asked by At

I have to place 4 spines on the same chart with different Y ratios, so I need to set up 4 Y-axes.
I have read the "muti-axis" demo from QT creator, it shows a example of two Y-axis and the two Y-axis are put on left and right side.

2 Y axis Demo From QT Creator

It's good when there is only two spines, but when I have 4 spines, how to relocate the 4 Y axis? Is it possible to place the 4 Y-axis at the tick point of X-axis? like the image below.

4 Axis like this

1

There are 1 best solutions below

1
Arun Kumar B On

I used ChartJs2QML for displaying charts in QML.
Below is the approach I followed for multiple y axes. Maybe a similar approach can be adopted in Qt as well.

  • Show labels of all the y axes in the legend.
  • Show only one y axis by default. Hide all the other y axes.
  • On click of any y axes label in legend, hide the active y axis and show the clicked y axis.