1 Attachment(s)
How to replace number scale with text scale in qwtplot?
Hello,
I have draw simple graph using QwtPlot() and QwtPlotGrid().
Now I want to replace numbers on Y-axis with some text.
Please check the below attachment shows, I have achived right side of graph now I want graph looks like left side.
Attachment 13299
Thanking in advanced!
Re: How to replace number scale with text scale in qwtplot?
Overload QwtScaleDraw::label.
Uwe
Re: How to replace number scale with text scale in qwtplot?
Thanks Uwe, it will work, but I have some issues while working on.
I have tried to overload like below,
Code:
{
public:
QwtMyScaleDraw(){
}
virtual QwtText label
(double v
) const {
qDebug()<<"Input to Label"<<v;
}
And I use this above class as,
Code:
plot
->setAxisScaleDraw
(QwtPlot::yLeft,
new QwtMyScaleDraw
());
Quote:
Actual Output ==>
unknown(0)[11756]: Input to Label 0
unknown(0)[11756]: Input to Label 100
unknown(0)[11756]: Input to Label 10
unknown(0)[11756]: Input to Label 20
unknown(0)[11756]: Input to Label 30
unknown(0)[11756]: Input to Label 40
unknown(0)[11756]: Input to Label 50
unknown(0)[11756]: Input to Label 60
unknown(0)[11756]: Input to Label 70
unknown(0)[11756]: Input to Label 80
unknown(0)[11756]: Input to Label 90
unknown(0)[11756]: Input to Label 1000
unknown(0)[11756]: Input to Label 0
unknown(0)[11756]: Input to Label 200
unknown(0)[11756]: Input to Label 400
unknown(0)[11756]: Input to Label 600
unknown(0)[11756]: Input to Label 800
Why this first 12 lines of output in above? and from where that 100 comes in betwen 0 and 10 every time?
Quote:
Expected Output ==>
unknown(0)[11756]: Input to Label 0
unknown(0)[11756]: Input to Label 200
unknown(0)[11756]: Input to Label 400
unknown(0)[11756]: Input to Label 600
unknown(0)[11756]: Input to Label 800
unknown(0)[11756]: Input to Label 1000
These creates an issue because I want to add text labels to a line that is visible in the graph, and from the above outputs, I didn't able to understand which is visible line and which is not.
I have a list of text labels that I want to assing to each line which is visible in the graph (This I can manage to do).
Added after 44 minutes:
By using below code, now its resolve, I'm getting expected output.
Code:
plot->setAxisAutoScale(Qt::Axis::YAxis, false);
But their is little change in the output,
Quote:
Actual Output ==>
unknown(0)[11756]: Input to Label 0
unknown(0)[11756]: Input to Label 1000
unknown(0)[11756]: Input to Label 200
unknown(0)[11756]: Input to Label 400
unknown(0)[11756]: Input to Label 600
unknown(0)[11756]: Input to Label 800
Here above 1000 is comming between 0 and 200. Which causing my string list little disturb.
Quote:
Expected Output==>
unknown(0)[11756]: Input to Label 0
unknown(0)[11756]: Input to Label 200
unknown(0)[11756]: Input to Label 400
unknown(0)[11756]: Input to Label 600
unknown(0)[11756]: Input to Label 800
unknown(0)[11756]: Input to Label 1000