[solved] xy data plot in QML
Still a newb, but...
I need a QML widget that draws xy plots (not a bar graph) with a vector of data (from C++ that may arrive anytime.. so also need a
way to notify the widget about new data arrival).
I notice qt3d project and all its awesome fanciness.
But I do not see even a simple xy plot/graph widget I can use in QML.
I know about QWT, but I would rather avoid using it: I asked question how to integrate with QML but got very short,cryptic incomplete response that did not help at all).
I saw a discussion about creating a chart widget but it seems stalled (IIRC, waiting for scenegraph changes).
If there is 3d graphics, why is there no 2d? Should I even consider using qt3d for drawing xy plots?
If anyone have a complete functional example in QML that I could learn from, then of course that would be excellent.
If internet connection is available then you could use google charts!
If you can paint (using QPainter) then it's easy to integrate to QML.
I don't know QWT, but if they paint, you can easily integrate that into QML.
There is no 2d graphics, because it's already there (QPainter).
Thanks for the replies....
To geronik I would say:
Google charts is NOT an answer. It was not even the question.
To me, the lack of a graph widget is a big glaring hole in QML functionality, especially when you see all the very cool widgets that do exist.
If as minimoog77 suggests it is easy, then why isn't there even ONE that is part of the standard qt set of cool widgets?
I sad that integration with code that already uses QPainter is easy, not that plotting graph is easy to do. :)
I don't have experience with QWT, but you could use or look their code how they are painting xy graph. Inherit QDeclarativeItem, do your own painting, and that's it.
Qt was and is providing more or less standard widgets, it's not plotting library.
Check QML Canvas: http://qt.gitorious.org/qt-labs/qmlcanvas
This looks very interesting. I looked at the examples there and there is a plotting example. Do not see any documentation, but it seems like one possible path forward.
To get another idea you could look at this "example":http://www.developer.nokia.com/Community/Wiki/CS001627_-_Creating_a_custom_QML_element_with_Qt of drawing a line and expand on the concept.
Just wanted to say thanks to mlong for posting that line example. I will be using that one.
No problem! I've used it before, as well, for similar functions :)
Be sure and rename the thread to add [Solved] if your question has been answered sufficiently. Thanks!
This thread seems ended. I guess I should mark it "solved", though there is plenty of interpretation and code to write.
Not sure how to mark this "solved". Can someone explain?
Edit your initial post and change the title, adding [Solved] at the beginning.
Could somebody post a code which might be of some help to beginners like me.. THank you.