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. QtCharts bar: histogram with sorted value (and animation)
Qt 6.11 is out! See what's new in the release blog

QtCharts bar: histogram with sorted value (and animation)

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 976 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.
  • M Offline
    M Offline
    malaga
    wrote on last edited by
    #1

    Hello,

    I am tryng to implement a histogram with sorted values (higher values first), these data are dynamics and change over times.
    Consequently, a bar (with its label) can change of position over time.

    I have seen "oscilloscope " and "temperature records" examples, which are very helpful but I have not seen any way to move bars easily.

    Below is a very basic mockup with what I am tryng to implement:
    chart_mockup.png

    • Is it possible to move a bar with its label easily by manipulating chart object?
    • Is it possible to move bars (laterally) with animations? it would be great!
    • What is the best way to implement this data viewer easily (knowing that data are updated just one time per second and they are less than 100 bars, so it is not a very CPU sensitive task)

    Any help would be greatly appreciated!

    Thank you in advance.

    Pl45m4P 1 Reply Last reply
    0
    • M malaga

      Hello,

      I am tryng to implement a histogram with sorted values (higher values first), these data are dynamics and change over times.
      Consequently, a bar (with its label) can change of position over time.

      I have seen "oscilloscope " and "temperature records" examples, which are very helpful but I have not seen any way to move bars easily.

      Below is a very basic mockup with what I am tryng to implement:
      chart_mockup.png

      • Is it possible to move a bar with its label easily by manipulating chart object?
      • Is it possible to move bars (laterally) with animations? it would be great!
      • What is the best way to implement this data viewer easily (knowing that data are updated just one time per second and they are less than 100 bars, so it is not a very CPU sensitive task)

      Any help would be greatly appreciated!

      Thank you in advance.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @malaga said in QtCharts bar: histogram with sorted value (and animation):

      Is it possible to move a bar with its label easily by manipulating chart object?
      Is it possible to move bars (laterally) with animations? it would be great!

      Move where?
      What kind of animations?

      What is the best way to implement this data viewer easily (knowing that data are updated just one time per second and they are less than 100 bars, so it is not a very CPU sensitive task)

      Just repaint / create your bars once per second and make sure that your QBarSeries data has the correct order (append decreasing values, so your highest bar is on the left).


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      M 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @malaga said in QtCharts bar: histogram with sorted value (and animation):

        Is it possible to move a bar with its label easily by manipulating chart object?
        Is it possible to move bars (laterally) with animations? it would be great!

        Move where?
        What kind of animations?

        What is the best way to implement this data viewer easily (knowing that data are updated just one time per second and they are less than 100 bars, so it is not a very CPU sensitive task)

        Just repaint / create your bars once per second and make sure that your QBarSeries data has the correct order (append decreasing values, so your highest bar is on the left).

        M Offline
        M Offline
        malaga
        wrote on last edited by
        #3

        @Pl45m4

        Move where?
        What kind of animations?

        Sorry if this point was not explicit.
        Each bar is linked to an object name which is indicated with labels on the X axis. Since data are updated and change over time, and that bars are sorted (higher values first), a bar can move at right if its values decrease or move to the left if its value increase.
        For now, I achieve that by directly updating labels by using bar chart "categories" and by updating bar values, but I've not managed to have animations representing the evolution of the bar. I would like my bars to move laterally to the left and the right with animation, without directly "jumping" to their new positions (that is to say with linear interpolated positions between two data update)

        Pl45m4P 1 Reply Last reply
        0
        • M malaga

          @Pl45m4

          Move where?
          What kind of animations?

          Sorry if this point was not explicit.
          Each bar is linked to an object name which is indicated with labels on the X axis. Since data are updated and change over time, and that bars are sorted (higher values first), a bar can move at right if its values decrease or move to the left if its value increase.
          For now, I achieve that by directly updating labels by using bar chart "categories" and by updating bar values, but I've not managed to have animations representing the evolution of the bar. I would like my bars to move laterally to the left and the right with animation, without directly "jumping" to their new positions (that is to say with linear interpolated positions between two data update)

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @malaga said in QtCharts bar: histogram with sorted value (and animation):

          I would like my bars to move laterally to the left and the right with animation

          What if you slowly in-/decrease the X-value of your bars?! I guess, for "real animations" you have to create your own QChartView subclass or even a custom widget.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          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