1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-15 01:06:32 -05:00
shimapan/app/public/panel/controllers/DashCtrl.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

var angular = require('angular');
angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => {
2018-08-15 11:23:30 -04:00
const colorScheme = ['#2a9fd6'];
2018-09-15 14:00:20 -04:00
// Calculate and format descending dates back one week
const currentDate = new Date();
const oneDay = 1000 * 60 * 60 * 24;
let dates = Array.from({length: 7}, (date, i) => new Date(currentDate - oneDay * (6 - i)));
let labels = dates.map(date => date.toISOString().substr(5, 5));
2018-08-15 11:23:30 -04:00
$scope.uploadColors = colorScheme;
2018-09-15 14:00:20 -04:00
$scope.uploadLabels = labels;
$scope.uploadSeries = ['Uploads'];
2018-08-15 11:23:30 -04:00
$scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]];
$scope.uploadOptions = {
2018-08-15 11:23:30 -04:00
title: {
display: true,
text: 'Historical Uploads'
},
};
2018-08-15 11:23:30 -04:00
$scope.viewColors = colorScheme;
2018-09-15 14:00:20 -04:00
$scope.viewLabels = labels;
2018-08-15 11:23:30 -04:00
$scope.viewSeries = ['Views'];
$scope.viewData = [[5, 11, 4, 3, 7, 9, 21]];
$scope.viewOptions = {
title: {
display: true,
text: 'Historical Views'
}
};
}]);
{
}