From 1e648f2141f5ced38e5a7c53dbf8b280e1e1d870 Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Thu, 7 Nov 2013 00:38:01 +0000 Subject: Use the new Async object and also use the new summary include --- src/examples/rrdJFlotFilter.html | 100 ++++++++++----------------------------- 1 file changed, 25 insertions(+), 75 deletions(-) (limited to 'src/examples/rrdJFlotFilter.html') diff --git a/src/examples/rrdJFlotFilter.html b/src/examples/rrdJFlotFilter.html index 9d05aa1..61820ff 100644 --- a/src/examples/rrdJFlotFilter.html +++ b/src/examples/rrdJFlotFilter.html @@ -25,18 +25,8 @@ - - - - - - - - - - - - + + RRD Graphs with Flot @@ -62,31 +52,6 @@ // Remove the Javascript warning document.getElementById("infotable").deleteRow(0); - // fname and rrd_data are the global variable used by all the functions below - fname=document.getElementById("input_fname").value; - rrd_data=undefined; - - // This function updates the Web Page with the data from the RRD archive header - // when a new file is selected - function update_fname() { - // Finally, update the file name and enable the update button - document.getElementById("fname").firstChild.data=fname; - - var graph_opts={legend: { noColumns:4}}; - var ds_graph_opts={'Oscilator':{ color: "#ff8000", - lines: { show: true, fill: true, fillColor:"#ffff80"} }, - 'Idle':{ label: 'IdleJobs', color: "#00c0c0", - lines: { show: true, fill: true} }, - 'Running':{color: "#000000",yaxis:2}}; - - - // the rrdFlot object creates and handles the graph - var f=new rrdFlot("mygraph",rrd_data,graph_opts,ds_graph_opts); - } - - // Next three functions are for use in RRDFilterOp, - // which requires a list of functions, one for each DS - //Sum two DSs function SumDS(ds1,ds2) { this.getName = function() {return ds1+"+"+ds2;} @@ -114,58 +79,43 @@ } } - // This is the callback function that, - // given a binary file object, - // verifies that it is a valid RRD archive - // and performs the update of the Web page - function update_fname_handler(bf) { - var i_rrd_data=undefined; - if (bf.getLength()<1) { - alert("File "+fname+" is empty (possibly loading failed)!"); - return 1; - } - try { - var i_rrd_data=new RRDFile(bf); - } catch(err) { - alert("File "+fname+" is not a valid RRD archive!\n"+err); - } - - if (i_rrd_data!=undefined) { - rrd_data=i_rrd_data; - - //If only one DS, cannot sum anything - if (rrd_data.getNrDSs()<2) { - alert("Not enough elements ("+rrd_data.getNrDSs()+") in RRD to sum!"); - } - - + // this function is called after the data is loaded + // but before the graph is displayed + function mycallback(obj) { var op_list = []; //list of operations var DS_list = []; //list of DSs to sum in MultiSumDS var i = 0; //create a new rrdlist, which contains almost all original elements // plus additional operated-on DSs from RRDFilterOp - for (i=0;i -- cgit v1.2.3-2-g168b