PDA

View Full Version : qwtpolar radius scale step always autosteps regardless of setting



TonyInSoMD
19th March 2015, 10:26
void CPolFileGraph::SetupPolarPlot()
{

m_pPolarPlot = new QwtPolarPlot(ui.m_frame_Graph);
if(m_GraphSettings.GetAzimuthRange() == AZIMUTH_NEG_180_TO_180)
{
m_pPolarPlot->setScale(QwtPolar::Azimuth,180.0,-180.0,m_GraphSettings.GetAzimuthLabeling());
m_pPolarPlot->setAzimuthOrigin(3 * M_PI_2);
}
else
{
m_pPolarPlot->setScale(QwtPolar::Azimuth,360.0,0.0,m_GraphSettin gs.GetAzimuthLabeling());
m_pPolarPlot->setAzimuthOrigin(M_PI_2);
}
m_pPolarPlot->setScale(QwtPolar::Radius,-40,40,2.0);
bool AutoScaleOn1 = m_pPolarPlot->hasAutoScale(Qwt::Azimuth); // returns false showing auto scale is off
bool AutoScaleOn2 = m_pPolarPlot->hasAutoScale(QwtPolar::Radius); // returns false showing auto scale is off
m_PolarPlotGrid.showGrid(QwtPolar::Azimuth,true);
m_PolarPlotGrid.showGrid(QwtPolar::Radius,true);
m_PolarPlotGrid.showAxis(QwtPolar::AxisAzimuth,tru e);
m_PolarPlotGrid.showAxis(QwtPolar::AxisBottom,fals e);
m_PolarPlotGrid.showAxis(QwtPolar::AxisLeft,false) ;
m_PolarPlotGrid.showAxis(QwtPolar::AxisRight,true) ;
m_PolarPlotGrid.showAxis(QwtPolar::AxisTop,false);
m_PolarPlotGrid.attach(m_pPolarPlot);
m_pPanner = new QwtPolarPanner(m_pPolarPlot->canvas());
m_pPanner->setEnabled(true);
m_pMagnifier = new QwtPolarMagnifier(m_pPolarPlot->canvas());
m_pMagnifier->setEnabled(true);
}

I set up a polar plot with the above code. When I set the radius scale I set step to 2. I check to see if autoscale is on for Azimuth and Radius, Azimuth is off and Radius is on. I don't want it to be on. My radius axis seems to auto step the plot even though I set it for 2. In this case I get a step of 10 instead of 2. Am I doing something wrong or is it a bug in QwtPolar? Just for the heck of it I tried setting the step to 20 and still get the same result, it sets to 10.

Edit starts here.
OK, I screwed up on checking if autoscale is on/off. I fixed the code. It shows that autoscale is turned off for both axis, but the radius axis displays autoscale instead of the step I manually entered (F.e. 10.0 instead of 2.0 in the above code).

Uwe
19th March 2015, 12:56
It shows that autoscale is turned off for both axis, but the radius axis displays autoscale instead of the step I manually entered (F.e. 10.0 instead of 2.0 in the above code).
Not here with your code snippet. But the code in QwtPolarPlot is that simple, that you could easily use the debugger to check what goes wrong in your setup.

Uwe

TonyInSoMD
19th March 2015, 14:52
I tried changing the code in the demo (polardemo) that comes with qwtpolar and it still doesn't work. In the Plot constructor I changed this line in the code
setScale(QwtPolar::Radius,radialInterval.minValue( ), radialInterval.maxValue())
which sets it up to autoscale the division lines to
setScale(QwtPolar::Radius,radialInterval.minValue( ), radialInterval.maxValue(),8) but the scale division lines don't change, they stay at the autoscale division line values. I also tried 1.0 and 5.0 with no change. This is using the code that comes with qwtpolar as an example. I'm starting to firmly believe it's a bug. I mean it still does it when using code that supposedly works perfectly and changing one parameter, that should turn off autoscale and make it change to a user set value. Where does one report a bug?

Uwe
19th March 2015, 15:19
I tried changing the code in the demo (polardemo) that comes with qwtpolar and it still doesn't work.
When looking at your first posting you wrote, that "hasAutoScale(QwtPolar::Radius)" returns true after doing a "setScale(QwtPolar::Radius,-40,40,2.0);". This is what I checked and I can't confirm.


In the Plot constructor I changed this line in the code
setScale(QwtPolar::Radius,radialInterval.minValue( ), radialInterval.maxValue())
which sets it up to autoscale the division lines to setScale(QwtPolar::Radius,radialInterval.minValue( ), radialInterval.maxValue(),8) but the scale division lines don't change,.
Of course they doesn't change as you are using exactly the same parameters as what the autoscaling operation comes up with.

Guess you simply forgot to increase the maximum for the major steps: try


setScaleMaxMajor( QwtPolar::Radius, 40 );
setScale( QwtPolar::Radius, -40,40, 2.0 );and you will see an effect - event if probably not the one you want to have.


Where does one report a bug?
You already have my attention.

Uwe

TonyInSoMD
19th March 2015, 15:29
Inserting
setScaleMaxMajor( QwtPolar::Radius, 40 );
into the code fixed the problem. It works exactly as I wanted it to. Thanks!!!

sd
25th January 2021, 16:01
Hello,
I also had similar problems with the QwtPolar::Radius scale steps.
The solution : disabling the auto-scaling attribute of the QwtPolarGrid :
... .setGridAttribute( QwtPolarGrid::AutoScaling, false );