Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Simple histogram widget
Qt 6.11 is out! See what's new in the release blog

Simple histogram widget

Scheduled Pinned Locked Moved 3rd Party Software
12 Posts 3 Posters 17.9k 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    I don't want to reinvent the wheel and was looking for an histogram widget and I was surprised to find almost nothing.
    Ok there is Qwt. Their histogram class is not suitable to display an image histogram, but I could use QwtPlot. From what I have read it looks like it's a too complex solution for my very simple need.
    I also found KD Chart. Look nice but it not free.

    Is there anything else that I may have missed? Or should I start frm scratch? This histogram won't be a main component of my application that's why I'm a bit lazy :p

    EDIT: 09/04/2013
    Ended up with that:
    !http://i.imgur.com/aVryrpB.png(histo nice)!
    https://www.assembla.com/code/histogram/subversion/nodes

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      KDChart is available as open source (LGPL, I think).

      They don't advertise it, but if you download the trial version, and you look at the licence files, you will find that it actually has quite a liberal licence.

      P.S. You are right that you want to reuse an existing component for something like this, I think!

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        I downloaded and compiled KDChart. Then I tried to launch one of their examples and was welcomed with a bunch of error message ("Must construct a QApplication before a QPaintDevice").
        Is this library maintained?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JulienMaille
          wrote on last edited by
          #4

          I managed to get a simple histogram using KDChart.
          However the documentation look outdated. They provide a plugin for Designer but it won't load.
          Do you still use this library Andre?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            No, I am currently not using this library.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JulienMaille
              wrote on last edited by
              #6

              I have performance issues with KDChart. The whole GUI lags when trying to refresh an 256bins histogram at 24fps. A part from that the library is pretty.
              I had to downsize my dataset to 64 bins until I find something better.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JulienMaille
                wrote on last edited by
                #7

                I finally wrote my own class.
                Currently I kept it very basic. I subclassed QWidget, reimplemented the paintEvent() and called drawLine on my bins.
                !http://pix.wefrag.com/i/0/d/f/f/9/4128594b88684c5397acf44930d9bb72.png(histo)!
                Now I would like to add a bit of eyecandy and fill the area under the plot with a simple vertical gradient.
                Since I need to be able to refresh this ~50 times per seconds, is it risky to add this kind of unnecessary enhancements?
                What is recommended, drawing a polygon could be better?

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JulienMaille
                  wrote on last edited by
                  #8

                  Okay, I finally replaced my drawLine() calls with a polygon and a simple gradient.
                  Added a few vertical bars that scales nicely with the widget width.
                  !http://i.imgur.com/aVryrpB.png(histo nice)!
                  https://www.assembla.com/code/histogram/subversion/nodes

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    Looks quite pretty, actually! Nice work.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sfilippidis
                      wrote on last edited by
                      #10

                      Seems very cool!

                      https://www.filippidis.name/

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        JulienMaille
                        wrote on last edited by
                        #11

                        Thanks a lot.
                        I might share it after a bit of cleanup.

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JulienMaille
                          wrote on last edited by
                          #12

                          Code freely available here:
                          https://www.assembla.com/code/histogram/subversion/nodes

                          Feel free to contribute!

                          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