From ec10b8bff117d2775bffd4835e783d9d98dd32d1 Mon Sep 17 00:00:00 2001 From: orblazer Date: Fri, 5 May 2023 18:13:49 +0200 Subject: [PATCH] fix(graph): right handle gpu memory in percent ref: https://github.com/orblazer/plasma-applet-resources-monitor/issues/45#issuecomment-1536373480 --- package/contents/ui/components/graph/GpuGraph.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/contents/ui/components/graph/GpuGraph.qml b/package/contents/ui/components/graph/GpuGraph.qml index e820644..5fd36d7 100644 --- a/package/contents/ui/components/graph/GpuGraph.qml +++ b/package/contents/ui/components/graph/GpuGraph.qml @@ -38,7 +38,7 @@ RMBaseGraph.TwoSensorsGraph { for (let i = 0; i < sensorsModel.sensors.length; i++) { let value = sensorsModel.getInfo(i); if (i === 1 && plasmoid.configuration.gpuMemoryInPercent) { - value = value / uplimits[1]; + value = (value / maxQueryModel.maxMemory) * 100; } root._insertChartData(i, value); @@ -50,7 +50,7 @@ RMBaseGraph.TwoSensorsGraph { } _formatValue: (index, data) => { if (index === 1 && plasmoid.configuration.gpuMemoryInPercent) { - return i18nc("Percent unit", "%1%", Math.round((data.value / uplimits[1]) * 100) / 100); + return i18nc("Percent unit", "%1%", Math.round((data.value / maxQueryModel.maxMemory) * 1000) / 10); // This is for round to 1 decimal } return _defaultFormatValue(index, data); }