Improve memory graph y axis labeling

This commit is contained in:
Johannes Zellner
2022-10-14 21:39:34 +02:00
parent 4b995bb414
commit 76c2a978c9
+5 -4
View File
@@ -784,14 +784,14 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
ticks: { autoSkipPadding: 50, maxRotation: 0 }
},
y: {
ticks: { maxTicksLimit: 6 },
ticks: { maxTicksLimit: 6, stepSize: max && max <= 512 ? 256 : 512 },
min: 0,
beginAtZero: true
}
}
};
if (format) options.scales.y.ticks.callback = function (value) { return (formatDivisor ? (value/formatDivisor).toFixed(0) : value) + ' ' + format; };
if (format) options.scales.y.ticks.callback = function (value) { return (formatDivisor ? (value/formatDivisor) : value) + ' ' + format; };
if (max) options.scales.y.max = max;
var ctx = $(canvasId).get(0).getContext('2d');
@@ -803,7 +803,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.getAppGraphs(appId, timePeriod, function (error, result) {
if (error) return console.error(error);
var currentMemoryLimit = $scope.app.memoryLimit || $scope.app.manifest.memoryLimit || (256 * 1024 * 1024);
var currentMemoryLimit = $scope.app.memoryLimit || $scope.app.manifest.memoryLimit || 0;
var maxGraphMemory = currentMemoryLimit < (512 * 1024 * 1024) ? (512 * 1024 * 1024) : currentMemoryLimit;
var cpuCount = result.cpuCount;
var ioDivisor = 1000 * 1000;
@@ -812,7 +813,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.graphs.networkReadTotal = (result.networkReadTotal / ioDivisor / 1000).toFixed(2) + ' MB';
$scope.graphs.networkWriteTotal = (result.networkWriteTotal / ioDivisor / 1000).toFixed(2) + ' MB';
fillGraph('#graphsMemoryChart', [{ data: result.memory, label: 'Memory' }], 'memoryChart', 1024 * 1024, currentMemoryLimit / 1024 / 1024, 'GiB', 1024);
fillGraph('#graphsMemoryChart', [{ data: result.memory, label: 'Memory' }], 'memoryChart', 1024 * 1024, maxGraphMemory / 1024 / 1024, 'GiB', 1024);
fillGraph('#graphsCpuChart', [{ data: result.cpu, label: 'CPU' }], 'cpuChart', 1, cpuCount * 100, '%');
fillGraph('#graphsDiskChart', [{ data: result.blockRead, label: 'read' }, { data: result.blockWrite, label: 'write' }], 'diskChart', ioDivisor, null, 'kB/s');
fillGraph('#graphsNetworkChart', [{ data: result.networkRead, label: 'inbound' }, { data: result.networkWrite, label: 'outbound' }], 'networkChart', ioDivisor, null, 'kB/s');