summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/statistics/running.phtml
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-07 15:10:33 +0200
committerSebastian Wagner2011-10-07 15:10:33 +0200
commit3690f240e3d7926d561f660ca576056f429f3b15 (patch)
treecc279d817d20d2e535ca7c8f05bbaf3670b6337f /application/views/scripts/statistics/running.phtml
parentrename statistic (diff)
downloadpoolctrl-3690f240e3d7926d561f660ca576056f429f3b15.tar.gz
poolctrl-3690f240e3d7926d561f660ca576056f429f3b15.tar.xz
poolctrl-3690f240e3d7926d561f660ca576056f429f3b15.zip
rename statistic
Diffstat (limited to 'application/views/scripts/statistics/running.phtml')
-rwxr-xr-xapplication/views/scripts/statistics/running.phtml120
1 files changed, 120 insertions, 0 deletions
diff --git a/application/views/scripts/statistics/running.phtml b/application/views/scripts/statistics/running.phtml
new file mode 100755
index 0000000..4896eeb
--- /dev/null
+++ b/application/views/scripts/statistics/running.phtml
@@ -0,0 +1,120 @@
+<h1>Statistics - Running</h1>
+
+<link
+ rel="stylesheet" type="text/css"
+ href="/media/css/jquery.jqplot.min.css" />
+
+<select id="poolselectbox" name="PoolSelectbox"
+ onclick="setPoolIDtmp();" onChange="fetchPoolEvents();">
+ <option value="default">Please choose a Pool</option>
+ <option value="all">All Pools</option>
+</select>
+
+<script>
+
+//fetch all poolevents of the selected #poolselectbox value
+function fetchPoolEvents() {
+ poolID = $("#poolselectbox option:selected").val();
+ plot();
+}
+
+function setPoolIDtmp() {
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ }
+
+function plot() {
+ poolID = $("#poolselectbox option:selected").val();
+ $.get("/statistics/runninglist/poolID/" + poolID, function(data) {
+ if(data.dataBar == '0,Event over,0,Event not over' && poolID != 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ $( "#noEventsDialog" ).dialog('open');
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ //showDataLabels: true,
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ },
+ seriesColors: color,
+ highlighter: { show: false }
+ });
+ $('#plotPie').empty();
+ $.jqplot('plotPie', dataPie,
+ {
+ seriesDefaults: {
+ // Make this a pie chart.
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ // Put data labels on the pie slices.
+ // By default, labels show the percentage of the slice.
+ showDataLabels: true,
+ lineLabels: true,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'e' }
+ });
+ }
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+});
+
+$(function() {
+ $( "#noEventsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "No Events",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+</script>
+
+<div>
+<div id="plotBar" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+<div id="plotPie" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+</div>
+
+<!-- no events -->
+<div id="noEventsDialog" style="display: none">
+<p>There are no events in this pool to plot a statistic.</p>
+</div> \ No newline at end of file