summaryrefslogblamecommitdiffstats
path: root/application/views/scripts/statistics/success.phtml
blob: 5d5c89563e80d1de9571f1db3c55f475cddfb6d9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                   
                                         
 

                                                                  

                                               


                                                                















                                                           
                                                                      


                                                                              
                                     

                                             
                                     
                                                                           


                   
                                                   







                                                                         







                                                     
       
         

                                  







                                                                                 

                                             
                       

































                                                                                                             

                                                                             




                                                            
      
<h1>Statistics</h1>
<h2>How many events were successful?</h2>

<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/successplot/poolID/" + poolID, function(data) {
          if(data.dataBar == '0,Successful,0,Failed' && poolID != 'default') {
              $( "#noEventsDialog" ).dialog('open');
              $('#plotBar').empty();
              $('#plotPieS').empty();
            } else if (poolID == 'default') {
              $('#plotBar').empty();
              $('#plotPieS').empty();
            } else refreshPlot(data.dataBar, data.dataPieS, data.dataPieT);
        }, "json");
}

function refreshPlot(dataBar, dataPieS, dataPieT) {
    $('#plotBar').empty();
    $.jqplot('plotBar', dataBar, {
          seriesDefaults: {
          //renderer: $.jqplot.PieRenderer,
          renderer:$.jqplot.BarRenderer,
          pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
          shadowAngle: 135,
          rendererOptions: {
              barDirection: 'horizontal',
              varyBarColor : true
          }
      },
      axes: {
          yaxis: {
              renderer: $.jqplot.CategoryAxisRenderer
          }
      }
      });
    $('#plotPieS').empty();
    $.jqplot('plotPieS', dataPieS,
                    {
                      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,
                          varyBarColor : true
                        }
                      }
                    });
  }

$(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="plotPieS" 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>