diff --git a/src/views/app.js b/src/views/app.js index 33ecc8f14..1621a8c0a 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -6,7 +6,6 @@ /* global RSTATES */ /* global ISTATES */ /* global ERROR */ -/* global moment */ /* global Chart */ /* global Clipboard */ /* global SECRET_PLACEHOLDER */ @@ -629,7 +628,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location' var minuteSteps = timePeriod / datapoints.length; var labels = datapoints.map(function (d, index) { var dateTime = new Date(Date.now() - ((timePeriod - (index * minuteSteps)) * 60 * 1000)); - return ('0' + dateTime.getHours()).slice(-2) + ':' + ('0' + dateTime.getMinutes()).slice(-2); + + if ($scope.graphs.period > 24) { + return dateTime.toLocaleDateString(); + } else { + return dateTime.toLocaleTimeString(); + } }); var graphData = { @@ -654,6 +658,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location' intersect: false }, scales: { + xAxes: [{ + ticks: { + autoSkipPadding: 20, + } + }], yAxes: [{ ticks: { min: 0, diff --git a/src/views/system.js b/src/views/system.js index e59db0d6a..1111f6f4c 100644 --- a/src/views/system.js +++ b/src/views/system.js @@ -288,7 +288,12 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati var datapoints = data.datapoints.map(function (d) { return parseInt((d[0] / valueDivider).toFixed(2)); }); var labels = datapoints.map(function (d, index) { var dateTime = new Date(Date.now() - ((timePeriod - (index * timeBucketSize)) * 60 *1000)); - return ('0' + dateTime.getHours()).slice(-2) + ':' + ('0' + dateTime.getMinutes()).slice(-2); + + if ($scope.graphs.period > 24) { + return dateTime.toLocaleDateString(); + } else { + return dateTime.toLocaleTimeString(); + } }); var datasets = [{ @@ -328,6 +333,11 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati intersect: false }, scales: { + xAxes: [{ + ticks: { + autoSkipPadding: 20, + } + }], yAxes: [{ ticks: { min: 0,