Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
Hi all,
I am developing an application in which i have to dynamically update the position of QwtPlotMarker based on the data .
I have used QwtPlotMarker to draw a vertical line and i am calling following code in the timer function to update the position of the marker.
Code:
mx->setXvalue(data);replot();
The position of the vertical line is updated but there is a lot of flickering of the plot which is very annoying.
Plz tell me how to update position by using setXvalue() without flickering.
Hope i am clear. I am using qwt version 5.1.1
Raghav
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
w'll i am really appreciating a reply.
any suggestions????????????? :(
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
At least you have to explain what exactly happens ( visually ) , when you write about flickering.
Uwe
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
Ok.
I modified realtime (qwt) example such that instead of plotting points(default functionality) the program reads and plot some data from the file.
The program plots the data correctly.
After this i am moving a qwtmarker (VLine) over the plot by updating its position through a timer function.
Now as the position of marker is updated the already drawn plot, the grid lines and the marker, all flickers(refreshes) too much. I know that the refreshing (or flickering) is happening due the replot() given in the timer function as posted by me in the previous post.
But to update the position of marker dynamically i have to give a replot().
Is this the correct approach???????????
Is there other method to update the marker without redrawing the plot( by replot())
Hope i am clear this time.
Raghav
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
Quote:
Originally Posted by
raghvendramisra
I modified realtime (qwt) example such that instead of plotting points(default functionality) the program reads and plot some data from the file.
The realtime example disables all available backing stores in the state where it is painting data incrementally. With these attribute combination a repaint of the canvas will flicker.
Better use a plot canvas with its default attribute settings.
Uwe
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
I'm aware this thread is rather old, but my question is similiar:
Is there any way to update QwtPlotMarker position on the screen without replotting? I have a really big plot with loads of points and it leads to long time when replotting, but I wanted to change marker position in real time :/
I assume I should rewrite paintEvent function in my Plot class, right?
Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically
The problem is not about painting the marker - it is about erasing its previous position.
Your options are:
- introduce a QPixmap cache for the plot items without the marker, f.e cache all items below a specific z-value ( overload QwtPlot::drawItems() )
- use a QwtWidgetOverlay like in the itemeditor example ( drag the items to see how it works ).
The second solution is what you need to do when it is about dragging a marker with the mouse. Guess you could use the code with replacing QwtPlotShapeItem by QwtPlotMarker.
Uwe