Skip to content

Commit

Permalink
fix(graph): correctly show the value of clock when hover
Browse files Browse the repository at this point in the history
  • Loading branch information
orblazer committed Dec 2, 2021
1 parent 9ccd454 commit 43399c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions package/contents/ui/components/SensorGraph.qml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Item {
id: secondLineLabel
width: parent.width
height: contentHeight
property string lastValue: ''

text: secondLabel
color: secondLabelColor
Expand Down Expand Up @@ -259,7 +260,7 @@ Item {
if (plotter.values.length > 1) {
secondLineLabel.text = formatLabel(plotter.values[1], sensorGraph.secondSensorUnits)
secondLineLabel.visible = true
} else {
} else if (!secondLineLabel.keepVisible) {
secondLineLabel.text = ''
secondLineLabel.visible = false
}
Expand Down Expand Up @@ -306,7 +307,10 @@ Item {
firstLineLabel.text = formatLabel(plotter.values[0], sensorGraph.firstSensorUnits)
if (plotter.values.length > 1) {
secondLineLabel.text = formatLabel(plotter.values[1], sensorGraph.secondSensorUnits)
secondLineLabel.visible = (plotter.values[1] !== 0 || secondLabelWhenZero) ? true : false
secondLineLabel.visible = plotter.values[1] !== 0 || secondLabelWhenZero
} else if (secondLineLabel.lastValue != 0 && secondLabelWhenZero) {
secondLineLabel.text = secondLineLabel.lastValue
secondLineLabel.visible = true
} else {
secondLineLabel.text = ''
secondLineLabel.visible = false
Expand Down
3 changes: 2 additions & 1 deletion package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ Item {

// Update labels
if (cpuGraph.valueVisible) {
cpuGraph.secondLineLabel.text = cpuGraph.formatLabel(sensorData.getData(sensorData.sensors.averageClock), units)
cpuGraph.secondLineLabel.text = cpuGraph.secondLineLabel.lastValue = cpuGraph.formatLabel(
sensorData.getData(sensorData.sensors.averageClock), units)
cpuGraph.secondLineLabel.visible = true
}
}
Expand Down

0 comments on commit 43399c9

Please sign in to comment.