PDA

View Full Version : Is it wise to use GraphicsView for simple plot ?



Agent P.
31st August 2009, 11:49
Hi guys,

I wanna make an application in QtJambi that works with graphs. But unfortunately there's no QWT for QtJambi (as far as I know). So my question is this: Is it wise to use GraphicsView to make a simple graph or will the painting on QWidget suffice ? (If I'm getting this right in GraphicsView I would have to make an QLineF object for every two points I wanna connect, right ?)

wysota
31st August 2009, 12:00
If the plot is very simple, I'd use QWidget with QPainterPath. If it's more complex then QGraphicsView might prove better.

Agent P.
5th September 2009, 11:23
Thanks for recomendations.

I've got another question concerning transformations. That's so freakin' crazy chapter. :(I could read it again and again and still get very few from it.
When I draw a graph (suppose it's a constant function for now; in my case the signal is almost constant having very slight oscilations) and I start to scale it using scale() in y direction it start's to slowly come out of view (it's moving upwards). So I would assume scaling is not the same as zooming. And the question is then: How can zoom it in without the graph coming out of view ? (I need to scale it in y direction in order to emphasize the slight oscilation for better view; one could say the unit of lenght on y axis is smaller(after scaling it) then on the x axis)
It would help to say that before I draw anything I use setWindow(0, -height()/2, width(), height()) to set the origin of logical coordinates to be in the middle of height of the screen (y) and on the left side (it's a time series therefore x is not assumed to be negative; that's why it's on the left)
If one could explain the difference between the window-viewport and the worldMatrix() transformations I wouldn't mind at all. ;)

I know it's a lot to answer if you feel like you know something more to any above mentioned please post a reply I would be so greatfull.


Thanks in advance. (I'll provide additional info if needed, just to get the answers :D)