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

View File

@@ -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,