summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralisonjm <alisonjm>2011-06-08 21:28:37 +0000
committeralisonjm <alisonjm>2011-06-08 21:28:37 +0000
commitaab4bf1c827129caf72328ab1cbb7037b199a251 (patch)
tree580783b875be26a671fefba74ebebf811886cd98
parent8ba96f686e98dc592d13457cc4aa82e56e75a6f7 (diff)
New example laying out all options for rrdflot_deaults in RRDFlot.js.
-rw-r--r--src/examples/rrdJFlotDefaults.html118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/examples/rrdJFlotDefaults.html b/src/examples/rrdJFlotDefaults.html
new file mode 100644
index 0000000..7d17463
--- /dev/null
+++ b/src/examples/rrdJFlotDefaults.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Example HTML/javascript file that display the
+ content of a RRD archive file in a graph
+ using the Flot libraries
+ Part of the javascriptRRD package
+ Copyright (c) 2010 Frank Wuerthwein, fkw@ucsd.edu
+ Igor Sfiligoi, isfiligoi@ucsd.edu
+
+ Original repository: http://javascriptrrd.sourceforge.net/
+
+ MIT License [http://www.opensource.org/licenses/mit-license.php]
+
+-->
+
+<!--
+ This page requires Flot.
+
+ Repository: http://code.google.com/p/flot/
+
+-->
+
+<html>
+
+ <script type="text/javascript" src="../lib/binaryXHR.js"></script>
+ <script type="text/javascript" src="../lib/rrdFile.js"></script>
+
+ <!-- rrdFlot class needs the following four include files !-->
+ <script type="text/javascript" src="../lib/rrdFlotSupport.js"></script>
+ <script type="text/javascript" src="../lib/rrdFlot.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <head>
+ <title>RRD Graphs with Flot</title>
+ </head>
+
+ <body>
+ <h1 id="title">RRD Graphs with Flot</h1><h3>Applying all available rrdflot_defaults</h3>
+
+ RRD URL:
+ <input type="text" id="input_fname" value="example4.rrd"
+ onchange="fname_update()">
+ <button onclick="fname_update()">Update</button>
+ <hr>
+
+ <table id="infotable" border=1>
+ <tr><td colspan="21"><b>Javascript needed for this page to work</b></td></tr>
+ <tr><td><b>RRD file</b></td><td id="fname" colspan="5">None</td></tr>
+ </table>
+
+ <div id="mygraph"></div>
+
+ <script type="text/javascript">
+
+ // 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,
+ {num_cb_rows:9, use_element_buttons: true,
+ multi_ds:true, multi_rra: true,
+ use_rra: true, rra:1,
+ //If multi_ds is off, don't need to include "-GAUGE" in element names
+ use_checked_DSs: true, checked_DSs: ["ClientGlideIdle-GAUGE","ClientGlideTotal-GAUGE","StatusStageIn-GAUGE"],
+ use_windows:true, window_min:1241752800000,window_max:1241974500000,
+ graph_width:"700px",graph_height:"300px", scale_width:"350px", scale_height:"200px"});
+ }
+
+ // 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;
+ try {
+ var i_rrd_data=new RRDFile(bf);
+ } catch(err) {
+ alert("File "+fname+" is not a valid RRD archive!");
+ }
+ if (i_rrd_data!=undefined) {
+ rrd_data=i_rrd_data;
+ update_fname()
+ }
+ }
+
+ // this function is invoked when the RRD file name changes
+ function fname_update() {
+ fname=document.getElementById("input_fname").value;
+ try {
+ FetchBinaryURLAsync(fname,update_fname_handler);
+ } catch (err) {
+ alert("Failed loading "+fname+"\n"+err);
+ }
+ }
+
+ </script>
+ </body>
+</html>