mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
Squashed commit of the following:
commit 49e6c0040cc82c1e2684933a8e167ef14854aff8 Author: Julian Lam <julian@designcreateplay.com> Date: Thu Feb 25 16:12:15 2016 -0500 added recording and charts for topic and post counts globally and by cid commit e02ff70757f778aa016fbc42ef10a5da2d07a9d9 Author: Julian Lam <julian@designcreateplay.com> Date: Thu Feb 25 15:35:49 2016 -0500 added labels to charts commit e75d83bf3886e5183bcf5fcd848d71c513761e01 Author: Julian Lam <julian@designcreateplay.com> Date: Thu Feb 25 13:30:47 2016 -0500 added per category graphs to ACP management page commit e3f543200950925cc9e8bf33cccb592f949a100e Author: Julian Lam <julian@designcreateplay.com> Date: Thu Feb 25 12:36:11 2016 -0500 updated analytics to move helper methods to analytics lib and sending per category analytics to ACP page commit 01891d8f7c408925fcdad18dcaa941e5ebbeb9b2 Author: Julian Lam <julian@designcreateplay.com> Date: Wed Feb 24 16:48:55 2016 -0500 saving per-category analytics, and updated the writeData method to use async for "clarity"
This commit is contained in:
@@ -145,32 +145,6 @@ define('admin/general/dashboard', ['semver'], function(semver) {
|
||||
return (usePound?"#":"") + (g | (b << 8) | (r << 16)).toString(16);
|
||||
}
|
||||
|
||||
function getHoursArray() {
|
||||
var currentHour = new Date().getHours(),
|
||||
labels = [];
|
||||
|
||||
for (var i = currentHour, ii = currentHour - 24; i > ii; i--) {
|
||||
var hour = i < 0 ? 24 + i : i;
|
||||
labels.push(hour + ':00');
|
||||
}
|
||||
|
||||
return labels.reverse();
|
||||
}
|
||||
|
||||
function getDaysArray(from) {
|
||||
var currentDay = new Date(from || Date.now()).getTime(),
|
||||
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
labels = [],
|
||||
tmpDate;
|
||||
|
||||
for(var x=29;x>=0;x--) {
|
||||
tmpDate = new Date(currentDay - (1000*60*60*24*x));
|
||||
labels.push(months[tmpDate.getMonth()] + ' ' + tmpDate.getDate());
|
||||
}
|
||||
|
||||
return labels;
|
||||
}
|
||||
|
||||
function setupGraphs() {
|
||||
var trafficCanvas = document.getElementById('analytics-traffic'),
|
||||
registeredCanvas = document.getElementById('analytics-registered'),
|
||||
@@ -180,7 +154,7 @@ define('admin/general/dashboard', ['semver'], function(semver) {
|
||||
registeredCtx = registeredCanvas.getContext('2d'),
|
||||
presenceCtx = presenceCanvas.getContext('2d'),
|
||||
topicsCtx = topicsCanvas.getContext('2d'),
|
||||
trafficLabels = getHoursArray();
|
||||
trafficLabels = utils.getHoursArray();
|
||||
|
||||
if (isMobile) {
|
||||
Chart.defaults.global.showTooltips = false;
|
||||
@@ -325,9 +299,9 @@ define('admin/general/dashboard', ['semver'], function(semver) {
|
||||
}
|
||||
|
||||
if (units === 'days') {
|
||||
graphs.traffic.scale.xLabels = getDaysArray(until);
|
||||
graphs.traffic.scale.xLabels = utils.getDaysArray(until);
|
||||
} else {
|
||||
graphs.traffic.scale.xLabels = getHoursArray();
|
||||
graphs.traffic.scale.xLabels = utils.getHoursArray();
|
||||
|
||||
$('#pageViewsThisMonth').html(data.monthlyPageViews.thisMonth);
|
||||
$('#pageViewsLastMonth').html(data.monthlyPageViews.lastMonth);
|
||||
|
||||
Reference in New Issue
Block a user