feat: adjust CPU chart canvas height and update value formatting for better readability

This commit is contained in:
Eli Bosley
2025-09-23 14:42:34 -04:00
parent f7caf24ba9
commit 30d9d9c8e7

View File

@@ -412,7 +412,7 @@ switch ($themeHelper->getThemeName()) { // $themeHelper set in DefaultPageLayout
?>
<tr id='cpu_chart'>
<td>
<canvas id='cpuchart' style='width:100%; height:120px'></canvas>
<canvas id='cpuchart' style='width:100%; height:96px'></canvas>
</td>
</tr>
</tbody>
@@ -1447,7 +1447,7 @@ function getMillisPerPixel(timeInSeconds, containerId) {
// SmoothieCharts initialization
var cpuchart = new SmoothieChart({
millisPerPixel: (cpuline * 1000) / 600, // Safe initial value
minValue: 0,
minValue: -1,
maxValue: 100,
responsive: true,
grid: {
@@ -1466,10 +1466,10 @@ var cpuchart = new SmoothieChart({
minValueScale: 1.02,
maxValueScale: 1.02,
yMinFormatter: function(value) {
return Math.max(0, Math.floor(value));
return Math.max(0, Math.floor(value)) + ' %';
},
yMaxFormatter: function(value) {
return Math.floor(value);
return Math.max(0, Math.min(100, Math.ceil(value))) + ' %';
}
});