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.0k 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
    jiong
    wrote on 14 Jun 2018, 08:47 last edited by
    #1

    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!

    J J 2 Replies Last reply 14 Jun 2018, 08:50
    0
    • J jiong
      14 Jun 2018, 08:47

      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!

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 14 Jun 2018, 08:50 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 14 Jun 2018, 09:22
      0
      • J Offline
        J Offline
        jiong
        wrote on 14 Jun 2018, 08:59 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • J jsulm
          14 Jun 2018, 08:50

          @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 14 Jun 2018, 09:22 last edited by
          #4

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

          J 1 Reply Last reply 14 Jun 2018, 12:26
          0
          • J jiong
            14 Jun 2018, 08:47

            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!

            J Offline
            J Offline
            JonB
            wrote on 14 Jun 2018, 09:55 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
              14 Jun 2018, 09:22

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

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 14 Jun 2018, 12:26 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 J 2 Replies Last reply 15 Jun 2018, 00:53
              3
              • J jsulm
                14 Jun 2018, 12:26

                @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 15 Jun 2018, 00:53 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.

                J 1 Reply Last reply 15 Jun 2018, 13:09
                0
                • J jsulm
                  14 Jun 2018, 12:26

                  @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
                  JonB
                  wrote on 15 Jun 2018, 12:25 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"?

                  J 1 Reply Last reply 15 Jun 2018, 12:27
                  0
                  • J JonB
                    15 Jun 2018, 12:25

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

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 15 Jun 2018, 12:27 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

                    J 1 Reply Last reply 15 Jun 2018, 12:30
                    2
                    • J jsulm
                      15 Jun 2018, 12:27

                      @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.

                      J Offline
                      J Offline
                      JonB
                      wrote on 15 Jun 2018, 12:30 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 ;-) ]

                      J 1 Reply Last reply 15 Jun 2018, 12:32
                      0
                      • J JonB
                        15 Jun 2018, 12:30

                        @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 ;-) ]

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 15 Jun 2018, 12:32 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

                        J 1 Reply Last reply 15 Jun 2018, 12:36
                        3
                        • J jsulm
                          15 Jun 2018, 12:32

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

                          J Offline
                          J Offline
                          JonB
                          wrote on 15 Jun 2018, 12:36 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...

                          J 1 Reply Last reply 15 Jun 2018, 12:39
                          0
                          • J JonB
                            15 Jun 2018, 12:36

                            @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...

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 15 Jun 2018, 12:39 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

                            J 1 Reply Last reply 15 Jun 2018, 12:49
                            0
                            • J jsulm
                              15 Jun 2018, 12:39

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

                              J Offline
                              J Offline
                              JonB
                              wrote on 15 Jun 2018, 12:49 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
                                15 Jun 2018, 00:53

                                @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.

                                J Offline
                                J Offline
                                JonB
                                wrote on 15 Jun 2018, 13:09 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

                                9/15

                                15 Jun 2018, 12:27

                                • Login

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