Index: sources/gui/qml/components/BaseChart.qml =================================================================== diff -u -rd7cdeb52d868ce60c0fb5b6ac0e279c440ba99a8 -rd5aa2daeb2dfb38d93d128a85618b86855e07239 --- sources/gui/qml/components/BaseChart.qml (.../BaseChart.qml) (revision d7cdeb52d868ce60c0fb5b6ac0e279c440ba99a8) +++ sources/gui/qml/components/BaseChart.qml (.../BaseChart.qml) (revision d5aa2daeb2dfb38d93d128a85618b86855e07239) @@ -36,25 +36,9 @@ readonly property int minY : -700 readonly property int maxY : 600 - readonly property int plotFrequency : 1000 // 1000 * 60 // plot every 1 min + readonly property int plotFrequency : 1000 * 60 // plot every 1 min - /////////////////////////////// TODO: TEST REMOVE LATER /////////////////////////// - property int currentTime : 0 - readonly property int interval : 1 // interval to plot for DEMO - - function demoPlot() { - let now = new Date() - let newTime = new Date(now.getTime() + currentTime * 60 * 1000) - - if ( isOutsideWindow( newTime ) ) { shiftWindow(15) } // shift 15 min once out of scope - - _line1.append( newTime, lineSeries1Value ) - _line2.append( newTime, lineSeries2Value ) - _line3.append( newTime, lineSeries3Value ) - currentTime+=interval // inremement min - } - ////////////////////////////////// END REMOVE ////////////////////////////////////// - + // plot current reading at current time function plotGraph() { let now = new Date() @@ -77,8 +61,8 @@ } // Snap any date to the previous 5-minute mark - function snapToPreviousFiveMinutes(date) { - let newDate = new Date(date) + function snapToPreviousFiveMinutes( vDate ) { + let newDate = new Date(vDate) let minutes = newDate.getMinutes() let snappedMinutes = Math.floor(minutes / 5) * 5 @@ -89,8 +73,9 @@ return newDate } - function isOutsideWindow(time) { - return time > _xAxis.max + // Check if next plot is outside of current window + function isOutsideWindow( vTime ) { + return vTime > _xAxis.max } // when out of scope shift window by given min @@ -111,7 +96,7 @@ interval : _root.plotFrequency running : false repeat : true - onTriggered : demoPlot() // plotGraph() // demoPlot() demo code -- remove + onTriggered : plotGraph() } DateTimeAxis { id: _xAxis @@ -126,7 +111,7 @@ ValueAxis { id: _yAxis min : _root.minY max : _root.maxY - tickCount : 14 // 12 + tickCount : 14 labelFormat : "%i" color : _root.gridColor gridLineColor : _root.gridColor