Skip to content

Commit

Permalink
fix(graph): allow zero value in max y calculation
Browse files Browse the repository at this point in the history
Fix #27
  • Loading branch information
orblazer committed Jan 15, 2022
1 parent 70a4208 commit 020982f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ Item {
sensors: ["memory/physical/total", "memory/swap/total"]
enabled: true

property var totalMemory: 0
property var totalSwap: 0
property var totalMemory: -1
property var totalSwap: -1
onDataChanged: {
if(topLeft.column === 0) {
totalMemory = parseInt(data(topLeft, Sensors.SensorDataModel.Value))
Expand All @@ -195,7 +195,7 @@ Item {
totalSwap = parseInt(data(topLeft, Sensors.SensorDataModel.Value))
}

if ((!isNaN(totalMemory) && totalMemory !== 0) && (!isNaN(totalSwap) && totalSwap !== 0)) {
if ((!isNaN(totalMemory) && totalMemory !== -1) && (!isNaN(totalSwap) && totalSwap !== -1)) {
enabled = false

ramGraph.maxMemory = Math.max(totalMemory, totalSwap)
Expand Down

0 comments on commit 020982f

Please sign in to comment.