ChartView and scrollbar
Unsolved
QML and Qt Quick
-
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?
-
Have you tried to put it into Flickable {} ?
-
Thanks for clue, but seems like
ChartView
has fixed size.
I addedMouseArea
to handle it - it works like draggingChartView { 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 } } } }
-
Have you tried qchart with graphicsview framework?
-
Yes, in another project.
QGraphicsView
lays a top ofQAbstaractScrollArea
, 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.