Dear all,

I am totally new to plplot, so any advice is greatly appreciated.
Thank you all in advance (even reading the below)

In brief, I am wondering if anyone can help me out by telling me
- why clearWidget crashes after pljoin is called;
- what plclear actually does;
- how I can update a plot without performing a redraw (it has to be
cross-platform so pl_canvas_use_persistence will not help)
.. and any suggestions as to how I should do real-time plots will be
greatly appreciated!

Here is the specs of the systems I work with:
- CentOS 5.3, KDE, GCC, C++, QT 4.3.5, Plplot 5.9.4
- XP Prof SP2, MinGW 3.4.5, C++, QT 4.5.0, Plplot 5.9.4
- Vista Business, MinGW 3.4.5, C++, QT 4.5.0, Plplot 5.9.4

I am tryng to make class to draw simple 2-D real-time plots - like a
time-series (y(t) vs t);
This class has a QtExtWidget and has a recvData(float) function, where
it receives new y-values.
Essentially:
- It allows for N data points (PLFLT * data_y = new PLFLT[N] etc);
- It allows users to give it new values of y's and adds it to the end
of the data array;
- If more that N data points are received, the graph shifts left by D
points, as well as the data array (memcpy etc)
- I want to only redraw when necessary and use pljoin to line-segments
to what is already drawn.

Now,
- I have one QWidget holding the QtExtWidget plot. This class has only
one stream and one subpage.
- Originally I wanted to use PLJOIN when the i-th y-value is received
(with 0<=i< N, and is reset to i=N-D when i==N etc) and only redraw
the whole thing when I need to shift the plot;
- So essentially It does (here is C++ version, but C version also used)

void InitPlot(color and bounds parameters)
{
    plot->clearWidget();
    stream->adv(0), vpor, wind
    stream->col0, box// for axes
    stream->col0, wid// for line
}

idx = 1;
// Init data arrays
plstream * stream; QtExtWidget * plot;
// Initializing stuff like plsetqtdev, stream->init etc
InitPlot(parameters);

# On recv data - QT Slot
if(idx<N) stream->join(t[idx-1], y[idx-1], t[idx], y[idx]);
else
    // Shift Data Arrays and reset idx
    InitPlot(parameters);
    stream->line(....);

- All operations respect array boundaries etc properly
- On Linux I have to do QWidget::update() to see the new points added
to the plot by pljoin;
- On Windows I cannot points added to the plot by pljoin even after
doing QWidget::update();
- line-by-line debug revealed it crashes when the subsequent
plot->clearWidget()'s are called.
- stream->clear() or plclear didn't wherever I call these functions;
- on Linux, without doing clearWidget(), I can still do plavd and set
viewpoints and draw again but all exsisting lines and labels remain;
- on Windows without doing clearWidget(), I can still do plavd and set
viewpoints and draw again but pladv clears the plot (as it appears in
the QWidget);

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to