graphs: Compute width of system graph from total memory

Fixes #452
This commit is contained in:
Girish Ramakrishnan
2017-10-09 14:58:28 -07:00
parent 91ec2eaaf5
commit 815e5d9d9a

View File

@@ -93,10 +93,19 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati
var ctx = $('#memoryAppChart').get(0).getContext('2d');
var chart = new Chart(ctx);
var scaleStepWidth;
if ($scope.activeApp === 'system') {
console.log(Client.getConfig().memory);
scaleStepWidth = Math.round(Client.getConfig().memory / (1024 * 1024) / 10); // scaleSteps is 10
} else {
var memoryLimit = $scope.activeApp.memoryLimit || $scope.activeApp.manifest.memoryLimit || (256 * 1024 * 1024);
scaleStepWidth = Math.round(memoryLimit / (1024 * 1024) / 10); // scaleSteps is 10
}
var options = {
scaleOverride: true,
scaleSteps: 10,
scaleStepWidth: $scope.activeApp === 'system' ? 200 : ($scope.activeApp.manifest.memoryLimit ? parseInt($scope.activeApp.manifest.memoryLimit/10000000,10) : 20),
scaleStepWidth: scaleStepWidth,
scaleStartValue: 0
};