How to plot python x,y data in QtCharts
Unsolved
Qt for Python
-
I want to plot data (from python) in QML Qt chart. Normally for passing data from python to QML I use Signals and Slot. e.g. for passing int variable I create signal in python class
signalInt = Signal(int, arguments=['value'])
and later I callsignalInt.emit(23)
then catching the value in QML
In QML file:Connections { target: backend function onSignalInt(value) { tempVal = value; }
It works...
My questions:
- How to pass array or list (I need pass X and Y values to plot) from python to QML
- How to tell qtCharts to plot my X Y data?
I have these but it obviously does not work
Connections { target: backend function onSignaXYData(dataX,dataY) { plotDataX = dataX; plotDataY = dataY; } ChartView { title: "Line" anchors.fill: parent antialiasing: true ValueAxis{ id: axisX min: 0 max: 200 } ValueAxis{ id: axisY min: 0 max: 150 } LineSeries { id: lineSeries1 name: "data" axisX: axisX axisY: axisY XYSeries: plotDataX, plotDataY } }
Thank you very much!