PDA

View Full Version : Draw Custom Y-Axis Labels



TEAmerc
24th November 2015, 22:31
I have a plot that has the possibility of plotting many boolean values at once, so I've subclassed QwtSeriesData<QPointF> and added an offset if all the signals being plotted are booleans. However the y-axis won't show 0 for low now, and 1 for high (except on the single signal that doesn't get offset of course), but instead shows me <offset value> for low and <offset value + 1> for high.

So I wanted to know how I could draw a custom y-axis so I can just have 0's and 1's repeated all the way up at <offset value> intervals or if there was an easier way to change the Y-axis labels.

Thanks,
TEAmerc

Uwe
25th November 2015, 07:50
I didn't get what you are doing. Is it about having several curves displaying boolean values, where you shifted the curves in vertical direction to avoid, that they are visually overlapping ?

Uwe

TEAmerc
25th November 2015, 14:07
Yes, that's exactly what I'm doing, and I wanted to know if there was a way I could change the y-axis to still show their true values even when they're shifted.

Thanks,
TEAmerc

Uwe
25th November 2015, 15:22
Then your question boils down to overloading QwtAbstractScaleDraw::label().

Uwe

TEAmerc
25th November 2015, 15:58
I got it working with that, thanks.

TEAmerc