Markers - from C++ to QML
-
Hello,
I have a data Model in C++ that is connected to a line chart in QML.
The chart shows line coming from C++.Now I want to add markers in chart that are moveable.
I want to- add
- delete
- move them
How can I get this thing done? I have no idea at all. Please suggest me related links, examples and if possible a description of how the solution may look like.
Thanks -
@Sajjad-Ali the
Charts
module does not allow for a huge amount of customised behaviour, so unless your use case is explicitly supported by the built-in facilities, it is unlikely you will be able to do this by usingCharts
directly.What you can do is to overlay something on your chart area and implement whatever functionality you need.
There is an example here where someone wanted some more sophisticated markers than is supported by
Charts
. The solution in this case was to overlay aCanvas
, but perhaps anItem
with your marker items laid out within it might work for you.The main complication would be in syncing the marker positions with the chart content. Let's say you want to have a label associated with a particular point of a line series. Then you would have to do some work to map that point to the coordinates of the rectangle containing your chart and transfer that to your overlay. If your chart is dynamically updateable, zoomable, etc., this would have to be accounted for.