diff --git a/src/views/app.js b/src/views/app.js index e08e2aac2..7bd0c8398 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -726,7 +726,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' var borderColors = [ '#2196F3', '#FF6384' ]; var backgroundColors = [ '#82C4F844', '#FF63844F' ]; - function fillGraph(canvasId, contents, chartPropertyName, divisor, max, format, formatDivisor) { + function fillGraph(canvasId, contents, chartPropertyName, divisor, max, format, formatDivisor, stepSize) { if (!contents || !contents[0]) return; // no data available yet var datasets = []; @@ -784,7 +784,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' ticks: { autoSkipPadding: 50, maxRotation: 0 } }, y: { - ticks: { maxTicksLimit: 6, stepSize: max && max <= 512 ? 256 : 512 }, + ticks: { maxTicksLimit: 6 }, min: 0, beginAtZero: true } @@ -793,6 +793,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' if (format) options.scales.y.ticks.callback = function (value) { return (formatDivisor ? (value/formatDivisor) : value).toFixed(2) + ' ' + format; }; if (max) options.scales.y.max = max; + if (stepSize) options.scales.y.ticks.stepSize = stepSize; var ctx = $(canvasId).get(0).getContext('2d'); @@ -813,7 +814,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, maxGraphMemory / 1024 / 1024, 'GiB', 1024); + fillGraph('#graphsMemoryChart', [{ data: result.memory, label: 'Memory' }], 'memoryChart', 1024 * 1024, maxGraphMemory / 1024 / 1024, 'GiB', 1024, (maxGraphMemory / 1024 / 1024) <= 1024 ? 256 : 512); 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');