Index: sources/gui/qml/components/BaseChart.qml =================================================================== diff -u -rbf64129a9adff73e4ff07d1c0946a0ec8274f1be -raf06f02c35f69afe8c8cf9e45873161075dab3ac --- sources/gui/qml/components/BaseChart.qml (.../BaseChart.qml) (revision bf64129a9adff73e4ff07d1c0946a0ec8274f1be) +++ sources/gui/qml/components/BaseChart.qml (.../BaseChart.qml) (revision af06f02c35f69afe8c8cf9e45873161075dab3ac) @@ -48,6 +48,9 @@ _line1.append( now, lineSeries1Value ) _line2.append( now, lineSeries2Value ) _line3.append( now, lineSeries3Value ) + + var pos = _chartView.mapToPosition( _line1.at( _line1.count - 1), _line1 ) + _mouseArea.updateLinePosition( pos.x, pos.y ) // move vertical line to newest plot } // set window @@ -58,6 +61,7 @@ _xAxis.min = min _xAxis.max = max + plotGraph() // plot first point _timer.start() } @@ -150,7 +154,6 @@ width : 1 height : _chartView.plotArea.height y : _chartView.plotArea.y - visible : false // Hidden until touched ShapePath { strokeColor : "#CA8D36" @@ -196,12 +199,11 @@ } // --- Touch/Mouse Handling Area --- - MouseArea { + MouseArea { id: _mouseArea anchors.fill: parent hoverEnabled: true onPressed: { - _verticalLine.visible = true updateLinePosition(mouse.x, mouse.y) } onPositionChanged: { @@ -242,14 +244,10 @@ let first = series.at(0) let last = series.at(count - 1) - // if x is given before thie first point then return first y - if (x <= first.x) - return first.y + // set null if y not plotted yet in graph to display as -- + if ( x < first.x || x > last.x ) + return null - // if x is given after the last point then return last y - if (x >= last.x) - return last.y - // Binary Search for a fast look ip let left = 0 let right = count - 1