Debian Codegraph @

dojox/charting/tests/BidiSupport/mirror_chart2d_dynamics.html

raw symbols SCIP
1 <!--[if IE 7]>
2 <!DOCTYPE>
3 <html lang="en">
4 <head>
5 <![endif]-->
6 <!--[if IE 8]>
7 <!DOCTYPE>
8 <html lang="en">
9 <head>
10 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
11 <![endif]-->
12 <![if gte IE 9]>
13 <!DOCTYPE HTML>
14 <html lang="en">
15 <head>
16 <![endif]>
17 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
18 <title>Chart 2D: dynamics</title>
19 <style type="text/css">
20 @import "../../../../dojo/resources/dojo.css";
21 @import "../../../../dijit/tests/css/dijitTests.css";
22 @import "../../../../dijit/themes/tundra/tundra.css";
23
24 .dojoxLegendNode {border: 1px solid #ccc; margin: 5px 10px 5px 10px; padding: 3px}
25 .dojoxLegendText {vertical-align: text-top; padding-right: 10px}
26 </style>
27 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true, has:{'dojo-bidi': true}"></script>
28 <script type="text/javascript">
29 dojo.require("dijit.form.Button");
30 dojo.require("dijit.form.CheckBox");
31 dojo.require("dijit.form.ComboBox");
32 dojo.require("dojox.charting.Chart");
33 dojo.require("dojox.charting.axis2d.Default");
34 dojo.require("dojox.charting.plot2d.Columns");
35 dojo.require("dojox.charting.plot2d.ClusteredColumns");
36 dojo.require("dojox.charting.plot2d.StackedColumns");
37 dojo.require("dojox.charting.plot2d.Bars");
38 dojo.require("dojox.charting.plot2d.ClusteredBars");
39 dojo.require("dojox.charting.plot2d.StackedBars");
40 dojo.require("dojox.charting.plot2d.Areas");
41 dojo.require("dojox.charting.plot2d.StackedAreas");
42 dojo.require("dojox.charting.plot2d.Pie");
43 dojo.require("dojox.charting.plot2d.Grid");
44 dojo.require("dojox.charting.themes.CubanShirts");
45 dojo.require("dojox.charting.widget.Legend");
46
47 dojo.require("dojox.lang.functional.sequence");
48
49 dojo.require("dojo.parser");
50
51 var chart, legend, size = 10, magnitude = 30;
52
53 var getData = function(){
54 var data = new Array(size);
55 for(var i = 0; i < size; ++i){
56 data[i] = Math.random() * magnitude;
57 }
58 return data;
59 };
60
61 var getZeroes = function(){
62 return dojox.lang.functional.repeat(size, "-> 0", 0);
63 };
64
65 var makeObjects = function(){
66 chart = new dojox.charting.Chart("test");
67 chart.setTheme(dojox.charting.themes.CubanShirts);
68
69 if(dijit.byId("hAxis").get("checked")){
70 chart.addAxis("x", {natural: true, includeZero: true, fixUpper: "minor"});
71 }
72
73 if(dijit.byId("vAxis").get("checked")){
74 chart.addAxis("y", {vertical: true, natural: true, includeZero: true, fixUpper: "minor"});
75 }
76
77 chart.addPlot("default", {type: dijit.byId("plot").get("value"), gap: 2});
78
79 if(dijit.byId("grid").get("checked")){
80 chart.addPlot("grid", {type: "Grid", hMinorLines: true, vMinorLines: true});
81 }
82
83 for(var i = 1; i <= 5; ++i){
84 if(dijit.byId("s" + i).get("checked")){
85 chart.addSeries("Series " + i, getData(), {stroke: {color: "black", width: 1}});
86 }
87 }
88 if(dijit.byId("s6").get("checked")){
89 chart.addSeries("Series 6", getZeroes(), {stroke: {color: "black", width: 1}});
90 }
91
92 chart.setDir("rtl");chart.render();
93
94 legend = new dojox.charting.widget.Legend({chart: chart}, "legend");
95 };
96
97 dojo.addOnLoad(makeObjects);
98
99 changePlot = function(){
100 var type = dijit.byId("plot").get("value");
101 chart.addPlot("default", {type: type, gap: 2});
102 chart.setDir("rtl");chart.render();
103 legend.refresh();
104 };
105
106 changeGrid = function(){
107 if(dijit.byId("grid").get("checked")){
108 chart.addPlot("grid", {type: "Grid", hMinorLines: true, vMinorLines: true});
109 }else{
110 chart.removePlot("grid");
111 }
112 chart.setDir("rtl");chart.render();
113 };
114
115 changeX = function(){
116 if(dijit.byId("hAxis").get("checked")){
117 chart.addAxis("x", {natural: true, includeZero: true, fixUpper: "minor"});
118 }else{
119 chart.removeAxis("x");
120 }
121 chart.setDir("rtl");chart.render();
122 };
123
124 changeY = function(){
125 if(dijit.byId("vAxis").get("checked")){
126 chart.addAxis("y", {vertical: true, natural: true, includeZero: true, fixUpper: "minor"});
127 }else{
128 chart.removeAxis("y");
129 }
130 chart.setDir("rtl");chart.render();
131 };
132
133 changeSeries = function(n){
134 if(n == 6){
135 // special case
136 if(dijit.byId("s6").get("checked")){
137 chart.addSeries("Series 6", getZeroes(), {stroke: {color: "black", width: 1}});
138 }else{
139 chart.removeSeries("Series 6");
140 }
141 }else{
142 if(dijit.byId("s" + n).get("checked")){
143 chart.addSeries("Series " + n, getData(), {stroke: {color: "black", width: 1}});
144 dijit.byId("sb" + n).get("disabled", false);
145 }else{
146 chart.removeSeries("Series " + n);
147 dijit.byId("sb" + n).get("disabled", true);
148 }
149 }
150 chart.setDir("rtl");chart.render();
151 legend.refresh();
152 };
153
154 addSeries = function(n){
155 chart.addSeries("Series " + n, getData(), {stroke: {color: "black", width: 1}});
156 chart.setDir("rtl");chart.render();
157 legend.refresh();
158 };
159
160 </script>
161 </head>
162 <body class="tundra">
163 <h1>Chart 2D: dynamics</h1>
164 <button id="reset1" type="reset" dojoType="dijit.form.Button">Reset with no onClick handler should reset</button>
165
166 <table>
167 <tr>
168 <td>Plot:</td>
169 <td>
170 <select dojoType="dijit.form.ComboBox" id="plot" onChange="changePlot()">
171 <option value="Columns">Columns</option>
172 <option value="ClusteredColumns">ClusteredColumns</option>
173 <option value="StackedColumns">StackedColumns</option>
174 <option value="Bars">Bars</option>
175 <option value="ClusteredBars">ClusteredBars</option>
176 <option value="StackedBars">StackedBars</option>
177 <option value="Areas">Areas</option>
178 <option value="StackedAreas">StackedAreas</option>
179 <option value="Pie">Pie</option>
180 </select>
181 </td>
182 </tr>
183 <tr>
184 <td>Grid:</td>
185 <td>
186 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="grid" onChange="changeGrid()">
187 <label for="grid">include</label>
188 </td>
189 </tr>
190 <tr>
191 <td>X axis:</td>
192 <td>
193 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="hAxis" onChange="changeX()">
194 <label for="hAxis">include</label>
195 </td>
196 </tr>
197 <tr>
198 <td>Y axis:</td>
199 <td>
200 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="vAxis" onChange="changeY()">
201 <label for="vAxis">include</label>
202 </td>
203 </tr>
204 <tr>
205 <td>Series 1:</td>
206 <td>
207 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="s1" onChange="changeSeries(1)">
208 <label for="s1">include</label>
209 &nbsp;
210 <button dojoType="dijit.form.Button" id="sb1" onClick="addSeries(1)">Randomize</button>
211 </td>
212 </tr>
213 <tr>
214 <td>Series 2:</td>
215 <td>
216 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="s2" onChange="changeSeries(2)">
217 <label for="s2">include</label>
218 &nbsp;
219 <button dojoType="dijit.form.Button" id="sb2" onClick="addSeries(2)">Randomize</button>
220 </td>
221 </tr>
222 <tr>
223 <td>Series 3:</td>
224 <td>
225 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="s3" onChange="changeSeries(3)">
226 <label for="s3">include</label>
227 &nbsp;
228 <button dojoType="dijit.form.Button" id="sb3" onClick="addSeries(3)">Randomize</button>
229 </td>
230 </tr>
231 <tr>
232 <td>Series 4:</td>
233 <td>
234 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="s4" onChange="changeSeries(4)">
235 <label for="s4">include</label>
236 &nbsp;
237 <button dojoType="dijit.form.Button" id="sb4" onClick="addSeries(4)">Randomize</button>
238 </td>
239 </tr>
240 <tr>
241 <td>Series 5:</td>
242 <td>
243 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="true" id="s5" onChange="changeSeries(5)">
244 <label for="s5">include</label>
245 &nbsp;
246 <button dojoType="dijit.form.Button" id="sb5" onClick="addSeries(5)">Randomize</button>
247 </td>
248 </tr>
249 <tr>
250 <td>Series 6:</td>
251 <td>
252 <input type="checkbox" dojoType="dijit.form.CheckBox" checked="false" id="s6" onChange="changeSeries(6)">
253 <label for="s6">include</label>
254 &nbsp;this series contains all 0 values
255 </td>
256 </tr>
257 </table>
258 <div id="test" style="width: 600px; height: 400px;"></div>
259 <div id="legend"></div>
260 </body>
261 </html>