Important: Please read the Qt Code of Conduct -

suggestions for graphing/plotting

  • Hi all -

    I'm building an application whose UI will entail a simple 2D graph and a few line charts. Updates will probably occur every 100ms or so. It will look something like this:
    alt text
    After reading through the docs, and doing some googling, I discovered to my surprise that Qt doesn't appear to have any intrinsic graphing widgets. I did find a couple of 3rd party packages that look reasonable. Or, I suppose I could create my own with primitive constructs.

    Before I embark on this, though, I thought I'd ask those who have done something similar: what did you use, and would you use it again? Just looking for some guidance before I start.


  • Lifetime Qt Champion

    @mzimmers There is Qt Charts. It is not installed by default, but you can install it easily using Qt Maintenance Tool.

  • Before we can get into details, could you tell us your license needs?

    • Are you ok with GPL (i.e. no commercial use and no closed source)
    • Are you ok with paying for a license to use the product commercially/closed source?
    • Do you require week copyleft/permissive licenses (LGPL,MIT,Apache,Mozzilla)?

  • jsulm: thanks for pointing me to charts. I'd already glanced at it, and it didn't look quite right, but I'll look at it again.

    VRonin: for now I'm going to assume that we'll be OK with buying a commercial license, but since I'm still in the proof of concept stage, I'll be going GPL for now. So, either works, really.

  • Lifetime Qt Champion

    @VRonin GPL doesn't forbid commercial use (see here) however it doesn't really make sense to create a commercial application using GPL licensed API..

  • I'm really not concerned about licensing from a cost standpoint. If I can show the powers-that-be that Qt is a superior alternative, they'll have the funds for licensing.

    What I'm hoping to get out of this thread is some ideas based on their technical merits. I've briefly looked at Qt Charts and it's probably adequate (overkill, even) for my meager needs. I just need a 2D graph with points, and a few moving line charts. As I said, if I can keep these updated 10X/second, that will be fine.

  • I use QCustomPlot . It is simple and it has very nice features. I use it to plot some results for controlling robotics manipulators. Very good.

  • Lifetime Qt Champion

    I can also highly recommend CustomPlot.
    Simply, not expensive, and no complex build requirements.
    You be up and running in minutes.

  • @SGaist said in suggestions for graphing/plotting:

    @VRonin GPL doesn't forbid commercial use (see here) however it doesn't really make sense to create a commercial application using GPL licensed API..


    using the Lesser GPL permits use of the library in proprietary programs; using the ordinary GPL for a library makes it available only for free programs.

    On the matter at hand, the options are:

  • Lifetime Qt Champion

    @VRonin In this context, commercial meant "an application that you sell".

  • OK, I have a more specific design question. As the image above shows, I'll have 5 items to update (and there will be more). These will probably all update at the same time. Is it considered better to have separate signals for each of these items, or to create a data structure that contains all of their information, and have a "master" signal that passes the entire data structure?

    The first alternative is obviously simpler from the standpoint of keeping data current, but uses a lot more signals. The second would reduce the number of signals, but require me to maintain this data structure.

    Is there a rule of thumb for knowing when to break updates into multiple signals, and when to combine them?

    I suppose a third alternative would be to use the same signal and pass an argument indicating which item(s) are to be updated. This will make the code a little more complex, but would (probably) obviate the issue.


  • Qt Chart and KD Chart (unfortunately I have no other experience with the other tools mentioned so I can't comment on those) can link directly to a QAbstractItemModel to refresh as soon as you update your data in the model.

    Qt Chart, at the current development, however, refreshes the entire series every time 1 point changes making it quite slow when handling large volumes (did not test KD Chart under those conditions)

Log in to reply