PDA

View Full Version : axisScaleEngine Floating does not work as documented



rakkar
6th October 2009, 18:09
All I want is for the endpoints of the scale to match the outliers of the input sources. So if I have inputs 0,0 and 2000,1000, then the x axis should go from 0 to 2000 and the y axis to go from 0 to 1000.

So I have the code:



qwtPlot->axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);
qwtPlot->axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true);
qwtPlot->setAxisAutoScale(QwtPlot::xBottom);
qwtPlot->setAxisAutoScale(QwtPlot::yLeft);


The x axis is OK, and matches the inputs. But the Y axis goes from 0 to 30,000???

Thanks for the help.

Uwe
7th October 2009, 17:10
What are the parameter values of QwtLinearScaleEngine::autoScale for this scale ?

Uwe

rakkar
7th October 2009, 18:49
That's all the code I have. Isn't it supposed to read the values in the plot and do this automatically?

I added this but there's no change



QwtLinearScaleEngine *scaleEngine = new QwtLinearScaleEngine;
qwtPlot->setAxisScaleEngine(QwtPlot::xBottom, scaleEngine );
scaleEngine = new QwtLinearScaleEngine;
qwtPlot->setAxisScaleEngine(QwtPlot::yLeft, scaleEngine );
qwtPlot->axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);
qwtPlot->axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true);
qwtPlot->setAxisAutoScale(QwtPlot::xBottom);
qwtPlot->axisScaleEngine(QwtPlot::xBottom)->setMargins(0,0);
qwtPlot->setAxisAutoScale(QwtPlot::yLeft);
qwtPlot->axisScaleEngine(QwtPlot::yLeft)->setMargins(0,0);

Uwe
8th October 2009, 07:09
I asked for parameter values, that are passed at runtime to a certain method.

Uwe

rakkar
8th October 2009, 15:28
It's fixed now. I was using show() and hide() and didn't know it would adjust for that