summaryrefslogblamecommitdiffstats
path: root/application/views/scripts/statistic/index.phtml
blob: 17bcc152d9583dcdbcb93c2bcf8e5ce8ac20f66d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                
        












                                                           
                                                                    



                                                        
                     

 
                            
                           
                                

                                      
                                                                       
                         



















                                                                   
   


















                                                                                                             

         






                                                             
<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;
var foo;

//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, function(data) {
	  if(data == '') {
		  $( "#noEventsDialog" ).dialog('open');
		  $('#plot').empty();
	  } else refreshPlot(data);
	  }, "json");
}

function refreshPlot(data) {
	$('#plot').empty();
	$.jqplot('plot', data, {
        seriesDefaults: {
        renderer:$.jqplot.BarRenderer,
        pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
        shadowAngle: 135,
        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();
	    });
});

$(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 id="plot"
	style="height: 400px; width: 700px;"></div>

<!-- no events -->
<div id="noEventsDialog" style="display: none">
<p>There are no events in this pool to plot the statistic</p>
</div>