Debian Codegraph @

examples/stacking/index.html

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>Flot Examples: Stacking</title>
6 <link href="../examples.css" rel="stylesheet" type="text/css">
7 <script language="javascript" type="text/javascript" src="../../source/jquery.js"></script>
8 <script language="javascript" type="text/javascript" src="../../source/jquery.canvaswrapper.js"></script>
9 <script language="javascript" type="text/javascript" src="../../source/jquery.colorhelpers.js"></script>
10 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.js"></script>
11 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.saturated.js"></script>
12 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.browser.js"></script>
13 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.drawSeries.js"></script>
14 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.uiConstants.js"></script>
15 <script language="javascript" type="text/javascript" src="../../source/jquery.flot.stack.js"></script>
16 <script type="text/javascript">
17
18 $(function() {
19
20 var d1 = [];
21 for (var i = 0; i <= 10; i += 1) {
22 d1.push([i, parseInt(Math.random() * 30)]);
23 }
24
25 var d2 = [];
26 for (var i = 0; i <= 10; i += 1) {
27 d2.push([i, parseInt(Math.random() * 30)]);
28 }
29
30 var d3 = [];
31 for (var i = 0; i <= 10; i += 1) {
32 d3.push([i, parseInt(Math.random() * 30)]);
33 }
34
35 var stack = 0,
36 bars = true,
37 lines = false,
38 steps = false;
39
40 function plotWithOptions() {
41 $.plot("#placeholder", [ d1, d2, d3 ], {
42 series: {
43 stack: stack,
44 lines: {
45 show: lines,
46 fill: true,
47 steps: steps
48 },
49 bars: {
50 show: bars,
51 barWidth: 0.6
52 }
53 },
54 yaxis: {
55 autoScale:"exact"
56 }
57 });
58 }
59
60 plotWithOptions();
61
62 $(".stackControls button").click(function (e) {
63 e.preventDefault();
64 stack = $(this).text() == "With stacking" ? true : null;
65 plotWithOptions();
66 });
67
68 $(".graphControls button").click(function (e) {
69 e.preventDefault();
70 bars = $(this).text().indexOf("Bars") != -1;
71 lines = $(this).text().indexOf("Lines") != -1;
72 steps = $(this).text().indexOf("steps") != -1;
73 plotWithOptions();
74 });
75
76 // Add the Flot version string to the footer
77
78 $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
79 });
80
81 </script>
82 </head>
83 <body>
84
85 <div id="header">
86 <h2>Stacking</h2>
87 </div>
88
89 <div id="content">
90
91 <div class="demo-container">
92 <div id="placeholder" class="demo-placeholder"></div>
93 </div>
94
95 <p>With the stack plugin, you can have Flot stack the series. This is useful if you wish to display both a total and the constituents it is made of. The only requirement is that you provide the input sorted on x.</p>
96
97 <p class="stackControls">
98 <button>With stacking</button>
99 <button>Without stacking</button>
100 </p>
101
102 <p class="graphControls">
103 <button>Bars</button>
104 <button>Lines</button>
105 <button>Lines with steps</button>
106 </p>
107
108 </div>
109
110 <div id="footer">
111 Copyright &copy; 2007 - 2014 IOLA and Ole Laursen
112 </div>
113
114 </body>
115 </html>