[Solved] Is GraphicsViewFwk good enough to create a Graphs (charting) library ?
I'm considering using Qt to create a graphs library that will replace an existing MFC based one. The graph library will include many different series types such as line series, bar series, pie charts, step line series, points series to name a few. I have read some documentation (not in depth though) with regards to graphics programming in Qt and got to know that Qt offers QPainter based rendering as well as the use of QGraphicsScene for my situation. Since QGraphicsScene is designed for graphics that are based on user interactions such as selecting, scrolling, transforming etc. my initial idea was to develop it this way.
However I have concerns whether the QGraphicsScene would give as much performance as it can. The MFC based one used a double buffering scenario. I just want to know if the QGraphicsScene approach would be as fast as rendering in QPainter using a double buffering scheme.
The QGraphicsScene will give you the performance you are looking for. The Qwt library, which is a library like the one you are creating, uses QWidget and builds off of that. I would suggest checking the performance of that library to get a better idea of which way is best for you.
I've recently completed a simple "proof of concept" chart library for myself using QGraphicsScene.
Obviously a proof of concept isn't a polished end product, but you are welcome to look at what I've got so far (I'm distributing it under the GNU LGPL):
I am currently in the process of refactoring the library to make it more dynamic and to better conform to OOP principles, but it is going to take time as I can only pursue this project in my spare time.
Questions, comments, feedback and criticism are all equally welcome.
EDIT: Although this post doesn't answer any of your performance questions, I sincerely hope that it may still be helpful to you in some way.
Thanks. From your replies it is evident that I wil have to try it out for myself and see. I will first go ahead the Graphics View Framework way and see if it gives much performance depending on the number of points/bars/pie segments etc in the graph ( the number of Graphic Items in the Scene ). If it seems adequate I will accept that and if not I will have to try the QWidget way using QPainter.
@goblincoding: I am happy to have come across such a project. But my initial concerns in using the Graphics View Framework were to animate and to let the user make selections and interact with the chart. I didn't find any working example of such a functionality in your porject. However I will be glad to check out the code and get an idea of how things happen under the hood when coming up with my own implementation.
You are, unfortunately, very right. This library of mine is still very static and the redesign is slow-going (work responsibilities are picking up towards the end of the year). With regards to interaction, have a look at the Qt Chart example if you haven't done so yet:
Enjoy and good luck!