I have created Spline chart from points.
Now I would like to move on this chart using arrows on keyboard (left and right) and print all points (x,y) while moving.
'move' - I mean, place at the beginning of chart line 'bigger dot than chart line width' and use keyboard (<-,->) to move this dot.
How to do this?
You can draw a point on the graph with a QGraphicsEllipseItem : http://doc.qt.io/qt-4.8/qgraphicsellipseitem.html
Pass you chart item as a parameter to the QGraphicsEllipseItem.
Then create a QChartView :
where you can re-implement the function to catch the keys pressed :
When those keys are pressed you can go from a point to the next one. To retrieve a point position, use your spline series functions inherited from QXYSeries (http://doc.qt.io/qt-5/qxyseries.html) :
Transform the position in chart to the position in screen :
Then position your ellipseItem :
To display the x and y values same thing but use a QGraphicsSimpleTextItem instead of QGraphicsEllipseItem. You might have to adjust their position manually so they are not displayed on top of each other, for example:
And set the text: