Re: Flicker during replotting in QwtPlot
Brought to you by:
rathmann
From: Jussi R. <jus...@ko...> - 2014-09-30 13:55:41
|
<html> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">Hi Uwe,<br> <br> Here are some additional comments/tests:<br> - it seems that detachItems() redraws the plot, even if autoreplot is set to false. I believe this is the cause for flickering as the plot is first cleared and drawn (legend erased) and then soon drawn again (with the legend).<br> - when autoreplot is false, in same cases the plot is still redrawn without the replot command. For example, consider the following:<br> <pre wrap=""> curve1->setSamples(x,y); curve1->attach(qwtPlot); qwtPlot->replot(); curve2->setSamples(x,y2); curve2->attach(qwtPlot); I would expect to see only one curve (the situation at replot()), but my test program actually shows both curves. Best regards, Jussi </pre> On 29.9.2014 12:39, Jussi Rahola wrote:<br> </div> <blockquote cite="mid:542...@ko..." type="cite">Hi Uwe, <br> <br> Thanks for your quick answer. Here are some comments. <br> - your workaround indeed removes the flicker, but this is quite awkward to use in my code, as there are many plot curves used in the same plot and the number of curves is varying. <br> - this seems to be a bit of a timing issue. My original code gave only flicker in the debug mode but not in release mode. However, when I increased the number of plot points or used multiple curves, the flickering also occurred in release mode <br> - the breakpoint in qwtplot.cpp, line 643, was never reached <br> - during the slider movement, updatelayout and updatelegenditems are called twice, first for qwtplot::detachItems() and second time for qwtplot::replot(). <br> - in the attached code, on line 59, you can select three modes: <br> mode 0: original, one plot (now with 10000 samples) <br> mode 1: your proposed workaround <br> mode 2: two plot curves <br> <br> Please let me know if I can run additional tests. <br> <br> Best regards, <br> <br> Jussi <br> <br> On 26.9.2014 19:06, Uwe Rathmann wrote: <br> <blockquote type="cite">Hi Jussi, <br> <br> <blockquote type="cite">I'm seeing some flickering while updating plots rapidly, e.g. during a <br> slider movement. <br> </blockquote> The flickering in the screen capture is because the legend <br> dis/re-appears. An easy workaround might be to change the implementation <br> of your plot() method - like at the end of this answer. <br> <br> But on my linux box I can't confirm any flickering with your demo and to <br> be honest I'm wondering, how it is possible, that events are processed ( <br> resize + paint ) in a state without having a curve attached. <br> <br> Could you please help me out with debugging the issue on your box with <br> having a look for calls of QwtPlot::updateLayout(). As resizing of the <br> plot canvas only happens according to recalculations of the plot layout, <br> there has to be a call in a situation, where the legend gets hidden, <br> because it is empty. <br> <br> Please set a breakpoint in qwtplot.cpp, line 643 and post the call stack. <br> <br> Uwe <br> <br> -- <br> <br> void MainWindow::plot() { <br> <br> const QwtPlotItemList items = qwtPlot->itemList( <br> QwtPlotItem::Rtti_PlotCurve ); <br> <br> QwtPlotCurve* curve; <br> if ( items.isEmpty() ) <br> { <br> curve = new QwtPlotCurve("Sine"); <br> curve1->attach(qwtPlot); <br> } <br> else <br> { <br> curve = items.first(); <br> } <br> <br> QVector<double> x, y; <br> double coeff=slider->value(); <br> const double pi = 4 * atan(1.0); <br> const int nsamples=100; <br> for (int k=0; k <= nsamples; ++k) { <br> double xx=((double)k)/nsamples*2*pi; <br> x.append(xx); <br> y.append(sin(xx*coeff)); <br> } <br> curve1->setSamples(x,y); <br> <br> qwtPlot->replot(); <br> } <br> <br> <br> ------------------------------------------------------------------------------ <br> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer <br> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports <br> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper <br> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer <br> <a class="moz-txt-link-freetext" href="http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk">http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk</a> <br> _______________________________________________ <br> qwt-interest mailing list <br> <a class="moz-txt-link-abbreviated" href="mailto:qwt...@li...">qwt...@li...</a> <br> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/qwt-interest">https://lists.sourceforge.net/lists/listinfo/qwt-interest</a> <br> </blockquote> <br> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">------------------------------------------------------------------------------ Slashdot TV. Videos for Nerds. Stuff that Matters. <a class="moz-txt-link-freetext" href="http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk">http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk</a></pre> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ qwt-interest mailing list <a class="moz-txt-link-abbreviated" href="mailto:qwt...@li...">qwt...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/qwt-interest">https://lists.sourceforge.net/lists/listinfo/qwt-interest</a> </pre> </blockquote> <br> </body> </html> |