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. ChartView and scrollbar
QtWS25 Last Chance

ChartView and scrollbar

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlchartscroll bar
5 Posts 3 Posters 3.4k 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.
  • SeeLookS Offline
    SeeLookS Offline
    SeeLook
    wrote on last edited by
    #1

    Hi
    I couldn't find it in any doc.

    How to make ChartView scrollable with mouse (finger) when appended data goes out of defined X axis maximum?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vladstelmahovsky
      wrote on last edited by
      #2

      Have you tried to put it into Flickable {} ?

      1 Reply Last reply
      0
      • SeeLookS Offline
        SeeLookS Offline
        SeeLook
        wrote on last edited by
        #3

        Thanks for clue, but seems like ChartView has fixed size.
        I added MouseArea to handle it - it works like dragging

        ChartView {
            id: chartView
            MouseArea {
                anchors.fill: parent
                property int lastX: 0
                property int lastY: 0
                onPressed: {
                    lastX = mouse.x
                    lastY = mouse.y
                }
        
                onPositionChanged: {
                    if (lastX !== mouse.x) {
                        chartView.scrollRight(lastX - mouse.x)
                        lastX = mouse.x
                    }
                    if (lastY !== mouse.y) {
                        chartView.scrollDown(lastY - mouse.y)
                        lastY = mouse.y
                    }
                }
            }
        }
        
        
        1 Reply Last reply
        1
        • V Offline
          V Offline
          vorlket
          wrote on last edited by
          #4

          Have you tried qchart with graphicsview framework?

          SeeLookS 1 Reply Last reply
          0
          • V vorlket

            Have you tried qchart with graphicsview framework?

            SeeLookS Offline
            SeeLookS Offline
            SeeLook
            wrote on last edited by
            #5

            Yes, in another project.
            QGraphicsView lays a top of QAbstaractScrollArea, so scroll bars appears there out of a box. But it requires a few lines of code to add scrolling by drag a scene.
            This time I needed QML way.

            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