PDA

View Full Version : Splitting a single QwtPlotCurve



Axtroz
5th August 2011, 13:21
Hello!
First of all, I am really really sorry for my English.
I'm quite new to C++/Qt/Qwt and I'm writing a ping application which plots a real-time graph with Qwt on Windows.
I'll try to explain with a couple of pictures for clearance, because I don't know how to express myself.
So here goes...

This is the current state of my program:
http://img28.imageshack.us/img28/1603/current.th.png (http://imageshack.us/photo/my-images/28/current.png/)

As you can see around X 10 its working... kinda. When I receive an error (value < 0) it does plot it how it should.
But what I want is this:
http://img38.imageshack.us/img38/2613/desired.th.png (http://imageshack.us/photo/my-images/38/desired.png/)
Instead of plotting it below, leave a hole in the graph and continue anew.
I searched around the web and the forum and from what I understood I'm supposed to overload MyCurve::drawCurve. I know how to overload a function but I have no idea how to overload drawCurve to change color/disable the pen and brush in my case, so the plot should be invisible/. If you need the code for my plot, you can find it here: plotter.h (http://paste2.org/p/1565244) and here: plotter.cpp (http://paste2.org/p/1565247).

Thanks for all replies in advance!

Uwe
5th August 2011, 15:24
For this particular use case I would use different curves,

Uwe

Axtroz
5th August 2011, 18:39
Wouldn't this decrease performance? My app is a QWidget, that will be integrated into a larger app to ping multiple hosts.

Uwe
5th August 2011, 19:32
No - at least when you don't have 100nds of curves with only few points each.

There might even be the opposite effect - f.e. when many points are off the canvas clipping might be faster, because the bounding rectangle of many curves is completely outside the clip rectangle.

Like always: the best solution depends and you have to understand, what is going on.

Uwe