Show graph labels based on locale

This commit is contained in:
Johannes Zellner
2020-09-02 18:53:46 +02:00
parent b81196fa87
commit 2c3c8f8c4a
2 changed files with 22 additions and 3 deletions
+11 -2
View File
@@ -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,