PDA

View Full Version : Sorry - more QwtPlotZoomer questions



cnbp173
27th April 2010, 00:30
Hi,

I continue to have a little difficulty with the plot zoomers. I am using the same plot to display either time or distance data. The x Scales for these are completely different, i.e. distance 0 - 30 and time 0 - 3e-6s.

As such, I display them at different times, i.e. not on the same plot.

After each curve is plotted to the QwtPlot, I call pZoom->setZoomBase(). Then when I switch from time to distance, I clear the plot and destroy the old zoomer, then create a new one. Plot the distance curve and call pZoom->setZoomBase() again.

To my understanding, this should clear all the window conditions and reset the zoomer. However, when this happens, the plot retains the zoom base of the original time plot, i.e. xBottom 0- 3us and yLeft at the previous conditions.

Am I doing something stupid? I thought clear() did the job in the Plot and the destruction of the zoomer, would wipe out anything else.

Robbie

Uwe
27th April 2010, 06:40
Zooming in assigns scales explicitly and turns autoscaling off. If you want to have autoscaling later again you need to re-enable it.

Uwe

cnbp173
27th April 2010, 17:40
Thanks Uwe, good to know. Hopefully this will sort out a raft of problems....

mike_the_tv
4th May 2010, 16:49
Hi,

I continue to have a little difficulty with the plot zoomers. I am using the same plot to display either time or distance data. The x Scales for these are completely different, i.e. distance 0 - 30 and time 0 - 3e-6s.

As such, I display them at different times, i.e. not on the same plot.

After each curve is plotted to the QwtPlot, I call pZoom->setZoomBase(). Then when I switch from time to distance, I clear the plot and destroy the old zoomer, then create a new one. Plot the distance curve and call pZoom->setZoomBase() again.

To my understanding, this should clear all the window conditions and reset the zoomer. However, when this happens, the plot retains the zoom base of the original time plot, i.e. xBottom 0- 3us and yLeft at the previous conditions.

Am I doing something stupid? I thought clear() did the job in the Plot and the destruction of the zoomer, would wipe out anything else.

Robbie

Coincidently this is exactly what i want to do, use one plot to display two separate ranges of data at separate times.

Do you actually need to destroy the old zoomer and create a new one, can it not be detatched or kept disabled, or is the effort of creating simple enough to not warrent worrying about it. Basically the plot for me will change when user selects between a tab widget on a separate docked widget next to the plot area.

mike_the_tv
7th May 2010, 09:26
I have had some success with my implementation of switching zoomers on two distictly different plots by creating just a single zoomer per QwtPlot and then dumping or reloading the zoom stack from the zoomer with zoomStack() and setZoomStack() when I switch plots. I still have to sort out the zoom initialisation code but this approach looks promising and saves deleting and recreating zoomers.