PDA

View Full Version : QqtPlot setAxisLabelRotation doesnt work on zoom (QwtPlotMagnifier)



npatil15
21st January 2019, 08:06
Hi,

I have been working on plot where I want to roll the graph and Axis when display signal reached to the boundary of plot/widget.
So for this purpose I have used m_plot->setAxisLabelRotation(QwtPlot::xBottom, -50.0); and it works.

But when I zoom in/out (QwtPlotMagnifier), the rotation of graph and Axis is get disable automatically, How should I make it continue even after zooming effect.

Thanks

npatil15
21st January 2019, 13:13
Please anyone has any solution or suggestions over it ?

npatil15
24th January 2019, 10:05
Please somebody give some suggestions on this :confused:

Added after 34 minutes:

I just working on code, I have some experiences below,
- At start, the graph is automatically rotate the graph, as signal comes. But on wheel zoom, the auto scaling gets OFF. And graph not update its scale nor rotate.
- Then I have added m_plot->setAxisAutoScale(QwtPlot::xBottom, true); in QEvent::Wheel, which makes it auto scale every time but on zooming it zoomed only on Y-Axis not on X-Axis

Here I understand that I have set auto scaling on X-Axis so yes it will zoom only on Y-Axis.
So the question is how I can keep both in the code, i.e., I can able to zoom on both axis and also able to auto scale the graph ?

d_stranz
24th January 2019, 16:41
So the question is how I can keep both in the code, i.e., I can able to zoom on both axis and also able to auto scale the graph ?

This makes no sense. Think about it: Autoscaling means if you zoom the x axis, the y axis is scaled to the minimum and maximum y values within the x range. Or, if you zoom on y, then the x axis range is changed so that it is limited only to the range that holds the y values.

How could you possibly zoom both axes at the same time while also autoscaling both of them at the same time?

npatil15
25th January 2019, 05:04
You Right,
So I'm trying code hack, that what I want to do,

on wheel/scroll zoom or on plotzoom the auto scaling should false, and I guess I can do that,
So what I/m thinking to set a button/Marker on the legend, on pressing button auto scaling makes true/false, or emit a signal.

But I'm facing a challenge here, whenever I set button(QPushButton) on legend, it's get override by my 4 Markers and not able to adjust on the legend, as shown in the image below,
Second solutiion, I have tried to set 5th QwtPlotMarker and want to set clickable, but my other 4 markers have setDefaultItemMode checkable, So how I can set different setDefaultItemMode for 5th Marker ?
13013

npatil15
25th January 2019, 10:57
I have done it using small hack,

Use QGroupBox and add QCheckBox in QGroupBox. Then set QGroupBox setParent to QwtLegend.

Now QGroupBox is set at the top and set QwtLegend x-axis geometry to 70, i.e., end of the QGroupBox.
So here no one overlaps each other. And using checkbox I have triggered signal which set and reset my particular feature on the plot.

And thanks to the QGroupBox, in future I can easily add QPushButton also.

:cool: