Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Draw scrollable chart
compyler last edited by
I want to draw a stock chart (boxes along a time axis) with Qt. These charts have data for a long time period (i.e. year 2000 until now), but most of the time I only want to show a certain small period from the whole graph (for example only data for November 2013).
I am very new to Qt I have a hard time figuring out how to start. I want to make it as efficient as possible without flickering. I guess its a smart idea to only draw the part of the chart that the user currently sees?
Initially I thought I derive from QWidget, override paintEvent() and draw the whole graph. Then I put this widget into a QScrollArea. But first how does the QScrollArea know what part of the widget it has to show? Second I don't like the idea of drawing the whole graph. I need some "culling" that tells me: Only draw this time span of the graph.
Can anyone help me and tell how I could implement drawing such a scrollable graph? Thanks!
There are numerous chart drawing libraries for Qt:
- Uwe's "Qwt":http://qwt.sourceforge.net/
- Digia's "Qt Commercial Charts":http://qt.digia.com/Product/Qt-Core-Features--Functions/Charts/
- and "many":http://stackoverflow.com/questions/3537251/chart-library-for-qt others
Or you can base your implementation on "Qt tutorials":http://qt-project.org/doc/qt-4.8/itemviews-chart.html. That will make your task much harder, though.
SteveG last edited by
Tomasz, You seem to have extensive knowledge about various Qt libraries. Are there any web pages or sites that contains a "comprehensive" list of Qt libraries, frameworks, examples, tutorials or other resources? Thanks.
There are a few, yes. Google is your friend. Most known are:
SteveG last edited by
Thanks so much. I was aware of some of these and have looked in github, gitorious, sourceforge and others. I've also relied heavily on Google. However, it would be useful to have a repository that listed name, description, link, status, etc. in one place that the Qt community could constantly update.
inqlude is aspiring to do just that: but it's a new site, so it still needs to grow, build up it's database, etc. Their stuff is openly available on github and they are accepting lots of contributions on a daily basis.