Debian Codegraph @

dojox/charting/tests/log/test_chart2d_log_amd.html

raw symbols SCIP
1 <!DOCTYPE HTML>
2 <html lang="en">
3 <head>
4 <title>Chart 2D - Log Axis</title>
5 <meta http-equiv="X-UA-Compatible" content="IE=Edge">
6 <style type="text/css">
7 @import "../../../../dojo/resources/dojo.css";
8 @import "../../../../dijit/tests/css/dijitTests.css";
9 </style>
10 <!-- NOTE: This test uses amd style modules and loading, but must run in sync loading mode because it uses DTL which does not work async-->
11 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true"></script>
12 <script type="text/javascript">
13 require([
14 "dojo/_base/array",
15 "dojo/request",
16 "dojo/dom",
17 "dojo/dom-style",
18 "dojo/ready",
19 "dojox/charting/Chart",
20 "dojox/charting/themes/ThreeD",
21 "dojox/dtl",
22 "dojox/dtl/Context",
23 "dojox/dtl/tag/logic",
24 "dojox/charting/axis2d/Default",
25 "dojox/charting/axis2d/Log",
26 "dojox/charting/plot2d/Default",
27 "dojox/charting/plot2d/Lines",
28 "dojox/charting/plot2d/Areas",
29 "dojox/charting/plot2d/Markers",
30 "dojox/charting/plot2d/MarkersOnly",
31 "dojox/charting/plot2d/StackedLines",
32 "dojox/charting/plot2d/StackedAreas",
33 "dojox/charting/plot2d/Bars",
34 "dojox/charting/plot2d/ClusteredBars",
35 "dojox/charting/plot2d/Stacked",
36 "dojox/charting/plot2d/StackedBars",
37 "dojox/charting/plot2d/ClusteredColumns",
38 "dojox/charting/plot2d/StackedColumns",
39 "dojox/charting/plot2d/Bubble",
40 "dojox/charting/plot2d/Grid",
41 "dojox/charting/plot2d/Candlesticks",
42 "dojox/charting/plot2d/OHLC",
43 "dojox/charting/plot2d/Scatter"], function(arr, request, dom, domStyle, ready, Chart, ThreeD, dtl, Context, logic, DefaultAxis, LogAxis){
44 var charts = [
45 {
46 description: "Clustered columns with a Log Axis applied to Y Axis.",
47 makeChart: function(node){
48 (new Chart(node)).
49 setTheme(ThreeD).
50 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
51 addAxis("y", { type: LogAxis, vertical: true}).
52 addPlot("default", { type: "ClusteredColumns", gap: 10 }).
53 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
54 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
55 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
56 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
57 render();
58 }
59 },
60 {
61 description: "Stacked columns with a Log Axis applied to Y Axis.",
62 makeChart: function(node){
63 (new Chart(node)).
64 setTheme(ThreeD).
65 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
66 addAxis("y", { type: LogAxis, vertical: true}).
67 addPlot("default", { type: "StackedColumns", gap: 10 }).
68 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
69 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
70 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
71 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
72 render();
73 }
74 },
75 {
76 description: "Columns with a Log Axis applied to Y Axis.",
77 makeChart: function(node){
78 (new Chart(node)).
79 setTheme(ThreeD).
80 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
81 addAxis("y", { type: LogAxis, vertical: true}).
82 addPlot("default", { type: "Columns", gap: 10 }).
83 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
84 render();
85 }
86 },
87 {
88 description: "Bars with a Log Axis applied to X Axis.",
89 makeChart: function(node){
90 (new Chart(node)).
91 setTheme(ThreeD).
92 addAxis("x", { type: LogAxis, includeZero: true}).
93 addAxis("y", { vertical: true, fixLower: "minor", fixUpper: "minor", natural: true }).
94 addPlot("default", { type: "Bars", gap: 10 }).
95 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
96 render();
97 }
98 },
99 {
100 description: "Stacked bars with a Log Axis applied to X Axis.",
101 makeChart: function(node){
102 (new Chart(node)).
103 setTheme(ThreeD).
104 addAxis("x", { type: LogAxis, includeZero: true}).
105 addAxis("y", { vertical: true, fixLower: "minor", fixUpper: "minor", natural: true }).
106 addPlot("default", { type: "StackedBars", gap: 10 }).
107 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
108 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
109 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
110 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
111 render();
112 }
113 },
114 {
115 description: "Line Chart with a Log Axis applied to Y Axis.",
116 makeChart: function(node){
117 (new Chart(node)).
118 setTheme(ThreeD).
119 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
120 addAxis("y", { type: LogAxis, vertical: true}).
121 addPlot("default", { type: "Lines", markers: true}).
122 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
123 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
124 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
125 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
126 render();
127 }
128 },
129 {
130 description: "Line Chart with a Log Axis applied to Y Axis.",
131 makeChart: function(node){
132 (new Chart(node)).
133 setTheme(ThreeD).
134 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
135 addAxis("y", { type: LogAxis, vertical: true}).
136 addPlot("default", { type: "Stacked", lines: true, areas: false, markers: true}).
137 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
138 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
139 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
140 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
141 render();
142 }
143 },
144 {
145 description: "Line Chart with a Log Axis applied to Y Axis, Log base 2.",
146 makeChart: function(node){
147 (new Chart(node)).
148 setTheme(ThreeD).
149 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
150 addAxis("y", { type: LogAxis, vertical: true, log: 2}).
151 addPlot("default", { type: "Stacked", lines: true, areas: false, markers: true}).
152 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
153 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
154 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
155 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
156 render();
157 }
158 },
159 {
160 description: "Line Chart with a Log Axis applied to Y Axis, Log base 16.",
161 makeChart: function(node){
162 (new Chart(node)).
163 setTheme(ThreeD).
164 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
165 addAxis("y", { type: LogAxis, vertical: true, log: 16}).
166 addPlot("default", { type: "Stacked", lines: true, areas: false, markers: true}).
167 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
168 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
169 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
170 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
171 render();
172 }
173 },
174 {
175 description: "Line Chart with a Log Axis applied to Y Axis, Log base E (Eulers Number).",
176 makeChart: function(node){
177 (new Chart(node)).
178 setTheme(ThreeD).
179 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
180 addAxis("y", { type: LogAxis, vertical: true, log: Math.E}).
181 addPlot("default", { type: "Stacked", lines: true, areas: false, markers: true}).
182 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
183 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
184 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
185 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
186 render();
187 }
188 },
189 {
190 description: "Line Chart with a Log Axis applied to Y Axis with Large Data.",
191 makeChart: function(node){
192 request("largedata.json", {
193 handleAs: "json"
194 }). then(function(data){
195 var c = new Chart(node).
196 setTheme(ThreeD).
197 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
198 addAxis("y", { type: LogAxis, vertical: true}).
199 addPlot("default", { type: "Lines"});
200 var s;
201 for(s in data){
202 c.addSeries(s, data[s]);
203 }
204 c.render();
205 });
206 }
207 },
208 {
209 description: "Stacked Line Chart with a Log Axis applied to Y Axis with Large Data.",
210 makeChart: function(node){
211 request("largedata.json", {
212 handleAs: "json"
213 }). then(function(data){
214 var c = new Chart(node).
215 setTheme(ThreeD).
216 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
217 addAxis("y", { type: LogAxis, vertical: true}).
218 addPlot("default", { type: "Stacked", lines: true, areas: false});
219 var s;
220 for(s in data){
221 c.addSeries(s, data[s]);
222 }
223 c.render();
224 });
225 }
226 },
227 {
228 description: "Area Chart with a Log Axis applied to Y Axis.",
229 makeChart: function(node){
230 (new Chart(node)).
231 setTheme(ThreeD).
232 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
233 addAxis("y", { type: LogAxis, vertical: true}).
234 addPlot("default", { type: "Areas"}).
235 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
236 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
237 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
238 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
239 render();
240 }
241 },
242 {
243 description: "Area Chart with a Log Axis applied to Y Axis.",
244 makeChart: function(node){
245 (new Chart(node)).
246 setTheme(ThreeD).
247 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
248 addAxis("y", { type: LogAxis, vertical: true}).
249 addPlot("default", { type: "StackedAreas"}).
250 addSeries("Series A", [ 2, 1.1, 0.5, 1000, 500 ] ).
251 addSeries("Series B", [ 3, 1500, 250, 1, 2 ] ).
252 addSeries("Series C", [ 1000, 0.5, 1.1, 2, 3 ] ).
253 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 3] ).
254 render();
255 }
256 }
257 ];
258 var now = function(){
259 return (new Date()).getTime();
260 };
261
262
263 ready(function(){
264 var defaultStyle = { width: "400px", height: "200px" };
265 var tmpl = new dtl.Template(dom.byId("template").value);
266 var context = new Context({ charts: charts });
267 dom.byId("charts").innerHTML = tmpl.render(context);
268
269 arr.forEach(charts, function(item, idx){
270 var start = now();
271 var n = dom.byId("chart_"+idx);
272 domStyle.set(n, item.style||defaultStyle);
273 item.makeChart(n);
274 console.debug((now()-start), "ms to create:", (idx+1)+":", item.description);
275 });
276 });
277 });
278 </script>
279 </head>
280 <body>
281 <textarea id="template" style="display: none;">
282 {% for item in charts %}
283 <p>{{ forloop.counter }}: {{ item.description }}</p>
284 <div id="chart_{{ forloop.counter0 }}"></div>
285 {% endfor %}
286 </textarea>
287 <h1>Chart 2D - Log Axis</h1>
288 <div id="charts"></div>
289 </body>
290 </html>
291