Show graph labels based on locale
This commit is contained in:
+11
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user