summaryrefslogtreecommitdiff
path: root/src/examples/rrdJFlotDefaults.html
blob: 5df845493b8fa3e206d64fc5a6a124c122b5855b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!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://www.flotcharts.org/
 [Previous repository: http://code.google.com/p/flot/]

-->

<html>
  
    <script type="text/javascript" src="../lib/javascriptrrd.wlibs.js"></script>
    <!-- the above script replaces the rrdfFlotAsync,rrdFlot, rrdFlotSelection, rrdFile, binaryXHR and all the jquery libraries -->
  <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);

      var graph_opts={legend: { noColumns:4}};
      var ds_graph_opts={'ClientGlideIdle':{ color: "#ff8000", label: 'Idle Clinet Glideins', 
                                       lines: { show: true, fill: true, fillColor:"#ffff80"} },
                         'ClientGlideTotal':{ label: 'Total Client Glideins', color: "#00c0c0", 
                                  lines: { show: true, fill: true} },
                         'ClientInfoAge':{yaxis:2},
                         'StatusWait':{color: "#000000",yaxis:2}};
      var rrdflot_defaults={ 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",
                             timezone:"-5"};

       flot_obj=new rrdFlotAsync("mygraph",null,null,graph_opts,ds_graph_opts,rrdflot_defaults);

      // this function is invoked when the RRD file name changes
      function fname_update() {
        var fname=document.getElementById("input_fname").value;
        flot_obj.reload(fname);
        document.getElementById("fname").firstChild.data=fname;
      }

    </script>
  </body>
</html>