Debian Codegraph @

dojox/charting/tests/BidiSupport/mirror_Spider2d.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>Spider 2D</title>
19 <style type="text/css">
20 @import "../../../../dojo/resources/dojo.css";
21 @import "../../../../dijit/tests/css/dijitTests.css";
22 @import "../../../../dijit/themes/claro/claro.css";
23 @import "../../resources/Legend.css";
24
25 .dojoxLegendItem{
26 padding: 3px 5px 2px 5px;
27 }
28 .dojoxLegendItem .dojoxLegendText{
29 float: right;
30 margin-top: 2px;
31 }
32 .dojoxLegendItem .dojoxLegendIcon{
33 float: left;
34 }
35 .dojoxLegendItemRtl{
36 padding: 3px 5px 2px 5px;
37 }
38 .dojoxLegendItemRtl .dojoxLegendText{
39 float: left;
40 margin-top: 2px;
41 }
42 .dojoxLegendItemRtl .dojoxLegendIcon{
43 float: right;
44 }
45 .dojoxLegendHover{
46 background-color: #afd9ff;
47 cursor: pointer;
48 padding: 3px 5px 2px 5px;
49 }
50 .dojoxLegendActive{
51 cursor: pointer;
52 border: 2px solid #7dbefa;
53 padding: 1px 3px 0 3px;
54 }
55 </style>
56 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, has:{'dojo-bidi': true}"></script>
57 <script type="text/javascript">
58 dojo.require("dojo.parser");
59 dojo.require("doh.runner");
60
61 dojo.require("dojox.charting.Chart");
62 dojo.require("dojox.charting.plot2d.Spider");
63 dojo.require("dojox.charting.themes.PlotKit.blue");
64 dojo.require("dijit.form.CheckBox");
65 dojo.require("dijit.form.RadioButton");
66 dojo.require("dijit.form.Form");
67 dojo.require("dojo.fx.easing");
68 dojo.require("dojox.gfx.fx");
69 dojo.require("dojox.charting.widget.SelectableLegend");
70
71 var dc = dojox.charting,
72 divisions = 7,
73 stype = "polygon",
74 easing = dojo.fx.easing.backOut;
75 var empty = {};
76 var populateSelect = function(from, select){
77 var module = dojo.getObject(from);
78 for(var name in module){
79 if(name in empty){ continue; }
80 var fun = module[name];
81 if(dojo.isFunction(fun)){
82 dojo.create("option", {
83 value: from + "." + name,
84 selected: name == "backOut",
85 innerHTML: from + "." + name
86 }, select);
87 }
88 }
89 };
90
91 var chart1, legend1;
92 makeObjects = function(){
93 chart1 = new dojox.charting.Chart("test1",{textDir:"rtl"});
94 chart1.setTheme(dojox.charting.themes.PlotKit.blue);
95 chart1.addPlot("default", {
96 type: "Spider",
97 labelOffset: -10,
98 divisions: divisions,
99 axisColor: "lightgray",
100 spiderColor: "silver",
101 seriesFillAlpha: 0.2,
102 spiderOrigin: 0.16,
103 markerSize: 3,
104 precision: 0,
105 spiderType: stype
106 });
107 chart1.addSeries("China.", {data: {"GDP.": 2,"area.": 6,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 2000,"inflation.": 15,"growth.": 12}}, { fill: "blue" });
108 chart1.addSeries("\u05e6\u05e8\u05e4\u05ea.", {data: {"GDP.": 6,"area.": 15,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 500,"inflation.": 5,"growth.": 6}}, { fill: "red" });
109 chart1.addSeries("USA.", {data: {"GDP.": 3,"area.": 20,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1500,"inflation.": 10,"growth.": 3}}, { fill: "green" });
110 chart1.addSeries("Start \u05e1\u05d5\u05e3.", {data: {"GDP.": 4,"area.": 2,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1000,"inflation.": 20,"growth.": 2}}, { fill: "yellow" });
111 chart1.addSeries("\u05d4\u05ea\u05d7\u05dc\u05d4 end.", {data: {"GDP.": 10,"area.": 10,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 800,"inflation.": 2,"growth.": 18}}, { fill: "orange" });
112 chart1.addSeries("Canada.", {data: {"GDP.": 1,"area.": 18,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 300,"inflation.": 3,"growth.": 15}}, { fill: "purple" });
113 chart1.setDir("rtl");
114 chart1.render();
115
116 legend1 = new dc.widget.SelectableLegend({chart: chart1, horizontal: true}, "legend1");
117
118 // prepare and enable controls
119 populateSelect("dojo.fx.easing", "easing");
120 };
121
122 dojo.addOnLoad(function(){
123 makeObjects();
124
125 doh.register("parse", function(){
126 dojo.parser.parse();
127 });
128
129 doh.register("test textDir", [
130 {
131 name: "Spider chart and legend.",
132
133 runTest: function(){
134 doh.is("rtl", chart1.textDir, "textDir of : chart1");
135 doh.is("rtl", legend1.textDir, "textDir of : legend1");
136
137 }
138 }
139 ]);
140
141 doh.run();
142
143 });
144
145 </script>
146
147 <script type="text/javascript">
148 function switchData(val){
149 if(val == "b1"){
150 chart1.updateSeries("China", {data: {"GDP.": 2,"area.": 6,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 2000,"inflation.": 15,"growth.": 12}}, { fill: "blue" });
151 chart1.updateSeries("\u05e6\u05e8\u05e4\u05ea.", {data: {"GDP.": 6,"area.": 15,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 500,"inflation.": 5,"growth.": 6}}, { fill: "red" });
152 chart1.updateSeries("USA.", {data: {"GDP.": 3,"area.": 20,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1500,"inflation.": 10,"growth.": 3}}, { fill: "green" });
153 chart1.updateSeries("Start \u05e1\u05d5\u05e3.", {data: {"GDP.": 4,"area.": 2,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1000,"inflation.": 20,"growth.": 2}}, { fill: "yellow" });
154 chart1.updateSeries("\u05d4\u05ea\u05d7\u05dc\u05d4 end.", {data: {"GDP.": 10,"area.": 10,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 800,"inflation.": 2,"growth.": 18}}, { fill: "orange" });
155 chart1.updateSeries("Canada.", {data: {"GDP.": 1,"area.": 18,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 300,"inflation.": 3,"growth.": 15}}, { fill: "purple" });
156 }else{
157 chart1.updateSeries("China", {data: {"GDP.": 8,"area.": 2,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 500,"inflation.": 2,"growth.": 18}}, { fill: "blue" });
158 chart1.updateSeries("\u05e6\u05e8\u05e4\u05ea.", {data: {"GDP.": 10,"area.": 6,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1000,"inflation.": 20,"growth.": 12}}, { fill: "red" });
159 chart1.updateSeries("USA.", {data: {"GDP.": 2,"area.": 5,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 1500,"inflation.": 12,"growth.": 6}}, { fill: "green" });
160 chart1.updateSeries("Start \u05e1\u05d5\u05e3.", {data: {"GDP.": 1,"area.": 20,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 500,"inflation.": 5,"growth.": 11}}, { fill: "yellow" });
161 chart1.updateSeries("\u05d4\u05ea\u05d7\u05dc\u05d4 end.", {data: {"GDP.": 4,"area.": 2,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 2000,"inflation.": 16,"growth.": 8}}, { fill: "orange" });
162 chart1.updateSeries("Canada.", {data: {"GDP.": 6,"area.": 10,"\u05d0\u05d5\u05db\u05dc\u05d5\u05e1\u05d9\u05d4.": 300,"inflation.": 3,"growth.": 2}}, { fill: "purple" });
163 }
164 chart1.render();
165 legend1 && legend1.refresh && legend1.refresh();
166 }
167
168 </script>
169
170 <script type="text/javascript">
171 function switchSpider(val){
172 stype = document.getElementById("b11").checked ? "polygon" : "circle";
173 if(val == "b11"){
174 chart1.addPlot("default", {
175 type: "Spider",
176 divisions: divisions,
177 spiderType: stype
178 });
179 }else{
180 chart1.addPlot("default", {
181 type: "Spider",
182 divisions: divisions,
183 spiderType: stype
184 });
185 }
186 chart1.render();
187 legend1 && legend1.refresh && legend1.refresh();
188 }
189
190 </script>
191
192 <script type="text/javascript">
193 function switchDivisions(val){
194 if(val == "b111"){
195 divisions = 7;
196 chart1.addPlot("default", {
197 type: "Spider",
198 divisions: divisions,
199 spiderType: stype
200 });
201 }else{
202 divisions = 3;
203 chart1.addPlot("default", {
204 type: "Spider",
205 divisions: divisions,
206 spiderType: stype
207 });
208 }
209 chart1.render();
210 legend1 && legend1.refresh && legend1.refresh();
211 }
212
213 </script>
214 <script type="text/javascript">
215 function switchAnimation(val){
216 easing = dojo.getObject(dojo.byId("easing").value);
217 chart1.addPlot("default", {
218 type: "Spider",
219 divisions: divisions,
220 spiderType: stype,
221 animationType: easing
222 });
223 chart1.render();
224 legend1 && legend1.refresh && legend1.refresh();
225 }
226
227 </script>
228
229 </head>
230 <body class="claro">
231 <h1>Spider 2D</h1>
232
233 <h2>
234 Spider 2D Demo:
235 </h2>
236 <p>
237 <span>
238 <span>Switch Year:</span>
239 <span>
240 <input dojoType="dijit.form.RadioButton" type=radio checked="checked" onClick="switchData(this.id)" name='a1' id='b1' value="1"/><label for='b1'> Figures in 2008 </label>
241 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input dojoType="dijit.form.RadioButton" type=radio name='a1' onClick="switchData(this.id)" id='b2' value="2"/><label for='b2'> Figures in 2009 </label>
242 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
243 <span><label>Animation Type:&nbsp;</label><select id="easing" onchange="switchAnimation()"></select></span>&nbsp;
244 </span>
245 </span>
246 </p>
247 <p>
248 <span>
249 <span>Switch Spider Type:</span>
250 <span>
251 <input dojoType="dijit.form.RadioButton" type=radio checked="checked" onClick="switchSpider(this.id)" name='a11' id='b11' value="polygon"/><label for='b11'> Polygon </label>
252 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input dojoType="dijit.form.RadioButton" type=radio name='a11' onClick="switchSpider(this.id)" id='b22' value="circle"/><label for='b22'> Circle </label>
253 </span>
254 </span>
255 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
256 <span>
257 <span>Switch Divisions:</span>
258 <span>
259 <input dojoType="dijit.form.RadioButton" type=radio checked="checked" onClick="switchDivisions(this.id)" name='a111' id='b111' value="1"/><label for='b111'> Divisions = 7 </label>
260 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input dojoType="dijit.form.RadioButton" type=radio name='a111' onClick="switchDivisions(this.id)" id='b222' value="2"/><label for='b222'> Divisions = 3 </label>
261 </span>
262 </span>
263 </p>
264 <h5>
265 The following legends are selectable:
266 </h5>
267 <div id="legend1"></div>
268 <p/>
269 <div id="test1" style="width: 500px; height: 500px;"></div>
270 <p/>
271 </body>
272 </html>