From 26a1aab152ee0bc1c68553199543550b270af86a Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 16 Nov 2011 16:28:47 +0100 Subject: new js files --- public/media/js/categoryPlot.js | 88 +++++++++++++++++++++++++++++++++++++++++ public/media/js/runningPlot.js | 86 ++++++++++++++++++++++++++++++++++++++++ public/media/js/successPlot.js | 86 ++++++++++++++++++++++++++++++++++++++++ public/media/js/typePlot.js | 86 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 346 insertions(+) create mode 100644 public/media/js/categoryPlot.js create mode 100644 public/media/js/runningPlot.js create mode 100644 public/media/js/successPlot.js create mode 100644 public/media/js/typePlot.js diff --git a/public/media/js/categoryPlot.js b/public/media/js/categoryPlot.js new file mode 100644 index 0000000..e633b9e --- /dev/null +++ b/public/media/js/categoryPlot.js @@ -0,0 +1,88 @@ +//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/categoryplot/poolID/" + poolID, function(data) { + if(data.dataBar == '' && poolID != 'default') { + $( "#noEventsDialog" ).dialog('open'); + $('#plotBar').empty(); + $('#plotPie').empty(); + } 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.BarRenderer, + pointLabels: { show: true, location: 'e', edgeTolerance: -15 }, + shadowAngle: 135, + rendererOptions: { + 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, + varyBarColor : true + } + }, + seriesColors: color + }); +} + +$(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"); + } + }); + }); \ No newline at end of file diff --git a/public/media/js/runningPlot.js b/public/media/js/runningPlot.js new file mode 100644 index 0000000..ff8a8f5 --- /dev/null +++ b/public/media/js/runningPlot.js @@ -0,0 +1,86 @@ +//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/runningplot/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); + }, "json"); +} + +function refreshPlot(dataBar, dataPie) { + $('#plotBar').empty(); + $.jqplot('plotBar', dataBar, { + seriesDefaults: { + renderer:$.jqplot.BarRenderer, + pointLabels: { show: true, location: 'e', edgeTolerance: -15 }, + shadowAngle: 135, + rendererOptions: { + barDirection: 'horizontal', + varyBarColor : true + } + }, + axes: { + yaxis: { + renderer: $.jqplot.CategoryAxisRenderer + } + } + }); + $('#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 + } + } + }); + } + +$(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"); + } + }); + }); \ No newline at end of file diff --git a/public/media/js/successPlot.js b/public/media/js/successPlot.js new file mode 100644 index 0000000..f2c0d7e --- /dev/null +++ b/public/media/js/successPlot.js @@ -0,0 +1,86 @@ +//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"); + } + }); + }); \ No newline at end of file diff --git a/public/media/js/typePlot.js b/public/media/js/typePlot.js new file mode 100644 index 0000000..09f12ad --- /dev/null +++ b/public/media/js/typePlot.js @@ -0,0 +1,86 @@ +//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/typeplot/poolID/" + poolID, function(data) { + if(data.dataBar == '0,other,0,repeat,0,immediate' && poolID != 'default') { + $('#plotBar').empty(); + $('#plotPie').empty(); + $( "#noEventsDialog" ).dialog('open'); + } else if (poolID == 'default') { + $('#plotBar').empty(); + $('#plotPie').empty(); + } else refreshPlot(data.dataBar, data.dataPie); + }, "json"); +} + +function refreshPlot(dataBar, dataPie) { + $('#plotBar').empty(); + $.jqplot('plotBar', dataBar, { + seriesDefaults: { + renderer:$.jqplot.BarRenderer, + pointLabels: { show: true, location: 'e', edgeTolerance: -15 }, + shadowAngle: 135, + rendererOptions: { + barDirection: 'horizontal', + varyBarColor : true + } + }, + axes: { + yaxis: { + renderer: $.jqplot.CategoryAxisRenderer + } + } + }); + $('#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 + } + } + }); + } + +$(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"); + } + }); + }); \ No newline at end of file -- cgit v1.2.3-55-g7522