summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/statistic/index.phtml
diff options
context:
space:
mode:
Diffstat (limited to 'application/views/scripts/statistic/index.phtml')
-rw-r--r--application/views/scripts/statistic/index.phtml78
1 files changed, 78 insertions, 0 deletions
diff --git a/application/views/scripts/statistic/index.phtml b/application/views/scripts/statistic/index.phtml
new file mode 100644
index 0000000..369a5a8
--- /dev/null
+++ b/application/views/scripts/statistic/index.phtml
@@ -0,0 +1,78 @@
+<h1>Category - Statistic</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>
+</select>
+
+<script>
+
+var lecture = 0;
+var boot = 0;
+var shutdown = 0;
+var maintenance = 0;
+
+//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("/statistic/categorylist/poolID/" + poolID + "/category/" + 1, function(data) {lecture = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 3, function(data) {boot = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 4, function(data) {shutdown = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 2, function(data) {maintenance = data; refreshPlot();});
+}
+
+function refreshPlot() {
+ $('#plot').empty();
+ $.jqplot('plot', [
+ [[boot,'Boot'], [shutdown,'Shutdwon'], [maintenance,'Maintenance'], [lecture,'Lecture']]], {
+ seriesDefaults: {
+ renderer:$.jqplot.BarRenderer,
+ // Show point labels to the right ('e'ast) of each bar.
+ // edgeTolerance of -15 allows labels flow outside the grid
+ // up to 15 pixels. If they flow out more than that, they
+ // will be hidden.
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ // Rotate the bar shadow as if bar is lit from top right.
+ shadowAngle: 135,
+ // Here's where we tell the chart it is oriented horizontally.
+ rendererOptions: {
+ barDirection: 'horizontal'
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ }
+ });
+}
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+
+ // For horizontal bar charts, x an y values must will be "flipped"
+ // from their vertical bar counterpart.
+});
+</script>
+
+<div id="plot"
+ style="height: 400px; width: 700px;"></div>