I'm trying to plot a chart with axis labels of different colors for positive and negative values, the effect is shown in the image below. Is there any way to achieve it? Thank you.
Asked
Active
Viewed 22 times
0

PX.Liu
- 171
- 1
- 7
-
I don't think you can do that with basic QValueAxis, but you could customize the appearance of custom ticks using QCategoryAxis, you only need to explicitly set the tick range. – musicamante Aug 27 '23 at 13:12
-
Thank you! This is indeed a workaround, and I'll try it in some charts with fixed axes. But it is so troublesome for axes with dynamic range. – PX.Liu Aug 28 '23 at 09:02
-
You need to rebuild the axis labels whenever the range changes. Just connect to the related signals of QValueAxis. – musicamante Aug 28 '23 at 10:57