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

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.
  • S Offline
    S Offline
    SeeLook
    wrote on 26 Dec 2016, 14:51 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 27 Dec 2016, 09:02 last edited by
      #2

      Have you tried to put it into Flickable {} ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SeeLook
        wrote on 27 Dec 2016, 11:17 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 13 Jan 2017, 04:37 last edited by
          #4

          Have you tried qchart with graphicsview framework?

          S 1 Reply Last reply 13 Jan 2017, 08:15
          0
          • V vorlket
            13 Jan 2017, 04:37

            Have you tried qchart with graphicsview framework?

            S Offline
            S Offline
            SeeLook
            wrote on 13 Jan 2017, 08:15 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