I am using the following wrapper: https://github.com/ncp1402/ql-lineplot to plot the data in real-time, I could plot the data in a static manner (not real time) however, on trying the below code (relevant for realtime), my application crashes (no error message)
import QtQuick 2.0
import 'src/qml'
import QtQuick.Layouts 1.2
QlLinePlot { id:plot; Layout.fillWidth:true; Layout.fillHeight:true;
// X/Y labels
labelX: 'time'
labelY: 'Values'
// show legend
legend: true
// enable/disable autorange
autoRange: true
// enable/disable X/Y mouse drag
dragX: true
dragY: true
// enable/disable X/Y mouse zoom (with Shift - only X, with Ctrl - only Y)
zoomX: true
zoomY: true
// enable/disable time/date format for X axis
xDate: true
// time/date format
xDateFormat: 'hh.mm.ss'
yPrev:[4,2,3]
property var colors: ['red']
property var names: ['T1']
Timer{
id:textTimer
interval:1000
repeat:true
running:true
triggeredOnStart: true
// initialize plot
Component.onCompleted: {
// remove all graphs
//clearGraphs();
// add new graphs
for (var i=0; i <= colors.length; i++)
addGraph(names[i], true, colors[i], 3, 'solid');
var i1=0;
while(adcreader.hasSample()) //check whether a sample is present or not
{
plot.addPoints(i1, [adcreader.getSample()]); //get it and plot
i1++;
}
plot.visible= true;
}
}
}
import QtQuick 2.0
import 'src/qml'
import QtQuick.Layouts 1.2
QlLinePlot { id:plot; Layout.fillWidth:true; Layout.fillHeight:true;
// X/Y labels
labelX: 'time'
labelY: 'Values'
// show legend
legend: true
// enable/disable autorange
autoRange: true
// enable/disable X/Y mouse drag
dragX: true
dragY: true
// enable/disable X/Y mouse zoom (with Shift - only X, with Ctrl - only Y)
zoomX: true
zoomY: true
// enable/disable time/date format for X axis
xDate: true
// time/date format
xDateFormat: 'hh.mm.ss'
yPrev:[4,2,3]
property var colors: ['red']
property var names: ['T1']
Timer{
id:textTimer
interval:1000
repeat:true
running:true
triggeredOnStart: true
// initialize plot
Component.onCompleted: {
// remove all graphs
//clearGraphs();
// add new graphs
for (var i=0; i <= colors.length; i++)
addGraph(names[i], true, colors[i], 3, 'solid');
var i1=0;
while(adcreader.hasSample()) //check whether a sample is present or not
{
plot.addPoints(i1, [adcreader.getSample()]); //get it and plot
i1++;
}
plot.visible= true;
}
}
}
To copy to clipboard, switch view to plain text mode
I think there is some mistake in the way I have tried to plot, since, I don't have experience of using Qt, any suggestions regarding the changes required will be great!
Bookmarks