Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML ChartView absolute scroll value (and zoomIn)
Forum Updated to NodeBB v4.3 + New Features

QML ChartView absolute scroll value (and zoomIn)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 549 Views
  • 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.
  • D Offline
    D Offline
    Developer123
    wrote on last edited by Developer123
    #1

    QML ChartViews have the default scroll methods such as:

    https://doc.qt.io/qt-5/qml-qtcharts-chartview.html#scrollDown-method

    They work by scrolling the view by some pixels to some direction. But this scroll is incremental (eg, calling mychart.scrollDown(3) twice will scroll by 6 pixels).

    Is there a way to scroll using an absolute value? (that is, scroll an amount based the initial chart position when the component was instantiated).

    In other words, "reset" the scroll, that is, set the total scroll to "0", and call the scrollDown() from there, when no scroll had been done yet.

    I'm asking because when using zoomIn() with the chart with scroll, and then zomming out, the scroll gets messed up (i.e, it doesn't go back to the place where it was "scrolled to" previous to calling zoomIn()) and so I would need to "reset" the scrolling somehow. I tried accumulating the "scroll amount" in a variable, but as I said, when scrolling with zoom enabled, the total scrolled amount in pixels is different for each zoom factor, and the value is ultimately wrong.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Developer123
      wrote on last edited by
      #2

      It turns out that zoomReset() resets the scroll as well, so all the scrolling made while zommed in is reverted:

      (from the Docs) Note: This will also reset scrolling and explicit axis range settings specified between the first zoom operation and calling this method. If no zoom operation has been performed, this method does nothing.

      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