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. QChart realtime performance
Forum Updated to NodeBB v4.3 + New Features

QChart realtime performance

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 7.2k 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 jiong

    Hi, I am using QChart for an application. The application need to show some data realtime. There will be one chart and 24 series in the chart. The data rate is 400pts for every channel.

    I used another thread for receiving and processing received data and emit the processed data to a slot for append datas to update the chart series.

    I refered to https://doc.qt.io/qt-5/qtcharts-audio-example.html. In my case, each series is limited to 2000 points, if the number of points in the series is less than 2000, add the new point to the series, if the number of points in the seried is more than 2000, delete first point, move the rest of datas to left and add the new point in the end. This will make the chart look like move from right to left.

    For good performance, I also used series->replace() and series->setUseOpenGL(true).

    My problem is that the application will get freezed soon when it started. I tried delete the codes of update the chart, everything looked fine. Could anyone help me how to improve the performance of update the chart?

    Thanks!

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @jiong said in QChart realtime performance:

    400pts

    What is this? Do you mean you get the data 400 times per second? It makes no sense to update the charts that often as no display can update so fast. Most display have a refresh rate of 60Hz.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    J 1 Reply Last reply
    0
    • J Offline
      J Offline
      jiong
      wrote on last edited by
      #3
      This post is deleted!
      1 Reply Last reply
      0
      • jsulmJ jsulm

        @jiong said in QChart realtime performance:

        400pts

        What is this? Do you mean you get the data 400 times per second? It makes no sense to update the charts that often as no display can update so fast. Most display have a refresh rate of 60Hz.

        J Offline
        J Offline
        jiong
        wrote on last edited by
        #4

        @jsulm Thanks for your reply. 400pts means reveiving 400 data points per second for each series.

        jsulmJ 1 Reply Last reply
        0
        • J jiong

          Hi, I am using QChart for an application. The application need to show some data realtime. There will be one chart and 24 series in the chart. The data rate is 400pts for every channel.

          I used another thread for receiving and processing received data and emit the processed data to a slot for append datas to update the chart series.

          I refered to https://doc.qt.io/qt-5/qtcharts-audio-example.html. In my case, each series is limited to 2000 points, if the number of points in the series is less than 2000, add the new point to the series, if the number of points in the seried is more than 2000, delete first point, move the rest of datas to left and add the new point in the end. This will make the chart look like move from right to left.

          For good performance, I also used series->replace() and series->setUseOpenGL(true).

          My problem is that the application will get freezed soon when it started. I tried delete the codes of update the chart, everything looked fine. Could anyone help me how to improve the performance of update the chart?

          Thanks!

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #5

          @jiong said in QChart realtime performance:

          My problem is that the application will get freezed soon when it started

          This will not improve the performance of the actual chart point updating, but if you mean the app freezes in the sense of no interaction/update you may find you need to QApplication::processEvents() at various times (e.g. after every 40 samples) if you mean you are not allowing that to run for UI input events already.

          1 Reply Last reply
          0
          • J jiong

            @jsulm Thanks for your reply. 400pts means reveiving 400 data points per second for each series.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @jiong You should not try to update the chart 400 times per second as it does not make sense. Instead do it like 24-60 times per second.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            J JonBJ 2 Replies Last reply
            3
            • jsulmJ jsulm

              @jiong You should not try to update the chart 400 times per second as it does not make sense. Instead do it like 24-60 times per second.

              J Offline
              J Offline
              jiong
              wrote on last edited by
              #7

              @jsulm Thanks for your great suggestion. It's better when I tried your method. But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?

              Thanks again.

              JonBJ 1 Reply Last reply
              0
              • jsulmJ jsulm

                @jiong You should not try to update the chart 400 times per second as it does not make sense. Instead do it like 24-60 times per second.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #8

                @jsulm
                Could you kindly explain why you say "as it does not make sense", rather than, say, "it is not efficient"?

                jsulmJ 1 Reply Last reply
                0
                • JonBJ JonB

                  @jsulm
                  Could you kindly explain why you say "as it does not make sense", rather than, say, "it is not efficient"?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @JonB What is the point to update the chart 400 times per second if the refresh rate of the display is 60Hz? A movie has typically a refresh rate of 24Hz - for human eye this is already smooth.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  JonBJ 1 Reply Last reply
                  2
                  • jsulmJ jsulm

                    @JonB What is the point to update the chart 400 times per second if the refresh rate of the display is 60Hz? A movie has typically a refresh rate of 24Hz - for human eye this is already smooth.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #10

                    @jsulm Fine, that's what I thought you had in mind. [FWIW, apes apparently have vastly faster image perception, so they might appreciate the 60 times per second ;-) ]

                    jsulmJ 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @jsulm Fine, that's what I thought you had in mind. [FWIW, apes apparently have vastly faster image perception, so they might appreciate the 60 times per second ;-) ]

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      @JonB Well, if you develop apps for apes then you should consider this :-)

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      JonBJ 1 Reply Last reply
                      3
                      • jsulmJ jsulm

                        @JonB Well, if you develop apps for apes then you should consider this :-)

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #12

                        @jsulm Till the OP specifies otherwise, I assume a Qt app's audience potentially includes any sentient being.... For all I know his app is part of experimental animal research. :) I have watched orang-utans interacting with PC screens at Washington DC Zoo...

                        jsulmJ 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @jsulm Till the OP specifies otherwise, I assume a Qt app's audience potentially includes any sentient being.... For all I know his app is part of experimental animal research. :) I have watched orang-utans interacting with PC screens at Washington DC Zoo...

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          @JonB But then you would need a display which can actually refresh that fast.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          JonBJ 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @JonB But then you would need a display which can actually refresh that fast.

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #14

                            @jsulm Which is why I said they might appreciate the 60 times per second rather than the 24. Though not the 400.

                            [Incidentally, have a look at https://books.google.co.uk/books?id=r4xywWpmXSEC&pg=PA15&lpg=PA15&dq=ape+vision+speed&source=bl&ots=ZGKKPG_adk&sig=qOypYm-Pg8rVfpsZ3hvdkMOR_2k&hl=en&sa=X&ved=0ahUKEwiOs8eu2tXbAhVrLcAKHVefAgQQ6AEIjAEwDw#v=onepage&q&f=true for just how much work is being done for ape-communication with software!]

                            I didn't mean to hijack this thread. I think the OP is still awaiting a further answer for:

                            @jiong
                            But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?

                            1 Reply Last reply
                            0
                            • J jiong

                              @jsulm Thanks for your great suggestion. It's better when I tried your method. But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?

                              Thanks again.

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #15

                              @jiong said in QChart realtime performance:

                              . But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?

                              You should have a read of https://stackoverflow.com/questions/38804179/how-to-repaint-a-qchart for your situation (which, incidentally, "append points at 400000 pts/sec", making your speed look trivial!).

                              1 Reply Last reply
                              1

                              • Login

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