Re: qwt plot and scrollbars
Brought to you by:
rathmann
|
From: <s.c...@gm...> - 2009-03-10 20:30:40
|
Hello, I did something like that... but not using Qwt and C++ but using Visual Basic 6 (shame on me ! but we use this at work !) and PictureBox control. I first did a circular buffer class that had a addItem(double value) method http://en.wikipedia.org/wiki/Circular_buffer It puts a value in a the reserved space of memory. When the memory reserved is full it overwrite the oldest value. This class also contain a private integer index to know where the value must be store. This class also have a method to get values : fromLastest(int index) FromLast(0) to get the latest value FromLast(1) to get the latest-1 value I use this circular buffer class in the plot object to store all the values. I use also use an integer value that belongs to the intervall 0 ; buffer.Capacity - window_capacity buffer.Capacity is the number of points in the circular buffer window_capacity is the number of points that can be shown in a "window" this integer value is used to know that part of the value need to be draw. You can find VB6 source code to get some API ideas at http://svn.berlios.de/viewcvs/openphysic/vb/vb6/phys/plot_scroll_window/ You can just have a look at source code using the SVN viewer If you want to do it in a clean C++ coding style you could maybe use the Boost implementation of circular buffer http://www.boost.org/doc/libs/1_38_0/libs/circular_buffer/doc/circular_buffer.html I hope this will help you I'm alway thinking (I talked about it some days ago) that a widget inherited from QwtPlot that cointains all this could be usefull but I'm not C++ developper (I'm just a little better than a beginer..) Kind regards On Tue, Mar 10, 2009 at 7:49 PM, Darryl Wallace <dar...@pr...> wrote: > Check out the realtime plot example that comes with Qwt. It shows how > to make a "ScrollZoomer" but that may help point you in the right direction. > > It'd be kind of a hack but you could implement the scrollzoomer, and > then when your data is added you can update the zoomRect. Or something > along those lines. > > darryl > > Giacomo S. wrote: >> Good morning. >> >> Is there a simple way to make my QwtPlot have the horizontal scrollbar >> automatically shown when the x data vector size reaches a certain value? >> >> For instance, when I have 200 elements in the x axis, I want the plot to >> enable scrolling. >> >> Thanks in advance >> >> Giacomo. >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> qwt-interest mailing list >> qwt...@li... >> https://lists.sourceforge.net/lists/listinfo/qwt-interest >> > > ------------------------------------------------------------------------------ > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest > |