Getting data from ChartView after plotting it
-
I see I can get the plotted data from the chart after plotting it using this Method:
QPointF at(int index)
https://doc.qt.io/archives/qt-5.10/qml-qtcharts-xyseries.html#append-method
, which :Returns the point at the position specified by index. Returns (0, 0) if the index is not valid.
but I don't know how to use it?
-
XYSeries is the class you are
usinginquiring about, it's a base class.
XYSeries is inherited By:
LineSeries, ScatterSeries, and SplineSeriesSo your instance of [LineSeries | ScatterSeries | SplineSeries]
ChartView { ... LineSeries { id: series ... onSomethingHasToHappen: { var values = series.at(indexToValue); }
-
@6thC said in Getting data from ChartView after plotting it:
series.at(indexToValue)
How to get the y element from this array!
-
@6thC said in Getting data from ChartView after plotting it:
series.at(indexToValue)
var values = series.at(indexToValue);
values object should give you x,y - I assume in a JS array or object with 2 real values? I don't read back only push to charts and I don't use qml to do it as its too slow for me.
This should help, a Qt.point apparently: http://doc.qt.io/qt-5/qml-point.html