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. How to get scrolling horizontal labels on a dynamic QChart? (Qt5.7.0)
Qt 6.11 is out! See what's new in the release blog

How to get scrolling horizontal labels on a dynamic QChart? (Qt5.7.0)

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 1.0k Views 2 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.
  • P Offline
    P Offline
    Peter_Du
    wrote on last edited by
    #1

    I have a regular QChart (Qt v5.7.0) in a QChartView widget. I've added a QDateTimeAxis for the horizontal axis, and a QValueAxis for the vertical axis. I've added a QLineSeries to the chart, and I periodically append points to the series, using the toMSecsSinceEpoch() of the arrival time as the X value for each point, and at the same time I change the range of the X axis (so that the max is now, and the min is now less 60 seconds). I also remove values from the series once there are enough of them to fill the range of the X axis.

    It produces the effect of having the signal appear on the right hand edge of the chart and then scroll nicely across the chart and then disappear off the left hand edge. While it is happening, the major vertical gridlines are fixed, with the time label under each gridline updating as time passes. This is acceptable, but I would like to be able to have the gridlines and the labels appear at the right hand edge and scroll across the chart with the signal (so that the label is fixed once it appears). Can anyone suggest how I might achieve this? I am a newcomer to Qt, so feel free to explain very basic concepts if needed.

    Using the PyQt bindings.

    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