Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Draw scrollable chart
Qt 6.11 is out! See what's new in the release blog

Draw scrollable chart

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    compyler
    wrote on last edited by
    #1

    Hello,

    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!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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/
      • "QCustomPlot":http://inqlude.org/libraries/qcustomplot.html
      • 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.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SteveG
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          There are a few, yes. Google is your friend. Most known are:

          • "inqlude":http://inqlude.org/
          • "Qt Project Add-Ons":http://qt-project.org/wiki/Category:Add-ons
          • "Qt Apps":http://qt-apps.org/

          (Z(:^

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SteveG
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              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.

              (Z(:^

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved