diff --git a/scp/dashboard.php b/scp/dashboard.php index 2ba6dc25b2cc486144598267b0639b733073bd02..34070aa55a4eede3294db04234d178aa28a9affa 100644 --- a/scp/dashboard.php +++ b/scp/dashboard.php @@ -28,7 +28,7 @@ require(STAFFINC_DIR.'header.inc.php'); <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="css/dashboard.css"/> -<h1>Ticket Activity</h1> +<h2>Ticket Activity</h2> <p>Select the starting time and period for the system activity graph</p> <form class="well form-inline" id="timeframe-form"> <label> @@ -55,7 +55,7 @@ require(STAFFINC_DIR.'header.inc.php'); <div style="position:absolute;right:0;top:0" id="line-chart-legend"></div> </div> -<h1>Current statistics</h1> +<h2>Current statistics</h2> <ul class="nav nav-tabs" id="tabular-navigation"></ul> <div id="table-here"></div> diff --git a/scp/js/dashboard.inc.js b/scp/js/dashboard.inc.js index 23deafc14a820df2712a3a93c12f45b461b607e9..0141204d52bc2f762ab4d9112939b62c95fca8e7 100644 --- a/scp/js/dashboard.inc.js +++ b/scp/js/dashboard.inc.js @@ -1,6 +1,4 @@ (function ($) { - var r, previous_data; - function refresh() { $('#line-chart-here').empty(); $('#line-chart-legend').empty(); @@ -15,16 +13,13 @@ 'stop': this.period.value} : {}), dataType: 'json', success: function(json) { - var previous_data = json, - times = [], + var times = [], smtimes = Array.prototype.concat.apply([], json.times), plots = [], max = 0; // Convert the timestamp to number of whole days after the - // unix epoch, and try and find an exact multiple of the - // number of days across the query that is less than 13 for - // the number of dates to place across the bottom. + // unix epoch. for (key in smtimes) { smtimes[key] = Math.floor(smtimes[key] / 86400); } @@ -32,11 +27,12 @@ e = json.events[key]; if (json.plots[e] === undefined) continue; $('<span>').append(e) - .attr({class:'label','style':'margin-left:0.5em'}) + .attr({'class':'label','style':'margin-left:0.5em'}) .appendTo($('#line-chart-legend')); $('<br>').appendTo('#line-chart-legend'); times.push(smtimes); plots.push(json.plots[e]); + // Keep track of max value from any plot max = Math.max(max, Math.max.apply(Math, json.plots[e])); } m = r.linechart(10, 10, width - 80, height - 20, @@ -47,7 +43,7 @@ shade: false, axis: "0 0 1 1", axisxstep: 8, - axisystep: max, + axisystep: Math.min(12, max), symbol: "circle", smooth: false }).hoverColumn(function () { @@ -59,7 +55,8 @@ if (this.symbols[i].node.style.display == "none") continue; var angle = 160; for (var j = 0, jj = slots.length; j < jj; j++) { - if (slots[j][0] == this.x && slots[j][1] == this.y[i]) { + if (slots[j][0] == this.x + && Math.abs(slots[j][1] - this.y[i]) < 20) { angle = 20; break; }