How to know scale span in QwtScaleDraw class
I want to display labels on x-axis according to the x-axis span. So if x-axis goes from 0-1000 I want to show label in certain format. However, if x-axis span is from 0-10000, I want the format to be different. I know that I need to derive from QwtScaleDraw and reimplement QwtScaleDraw::label(double) function to change the label. However, I cannot find a way to know what is the span of x-axis so that I send the requisite text format type.
Is there a way to know it from this class? If not, is there a work-around?
Re: How to know scale span in QwtScaleDraw class
Quote:
Originally Posted by
pkj
I know that I need to derive from QwtScaleDraw and reimplement QwtScaleDraw::label(double) function to change the label. However, I cannot find a way to know what is the span of x-axis so that I send the requisite text format type.
Uwe
Re: How to know scale span in QwtScaleDraw class
I think that QwtAbstractScaleDraw::scaleDiv().lowerBound and QwtAbstractScaleDraw::scaleDiv().upperBound() will give me the scales. But going through this thread it seems that lower bound is first set, and then upperbound is set. So does that mean the first time this class is implicitly asked for label, since its upper and lower bounds are not set by that time, the logic to send text based on bounds will fail?