Debian Codegraph @

dojox/charting/tests/test_anim2d.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 <title>Chart 2D: Animation tests</title>
18 <style type="text/css">
19 @import "../../../dojo/resources/dojo.css";
20 @import "../../../dijit/tests/css/dijitTests.css";
21 </style>
22 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
23 <script type="text/javascript">
24
25 dojo.require("dojox.charting.Chart");
26 dojo.require("dojox.charting.axis2d.Default");
27 dojo.require("dojox.charting.plot2d.ClusteredColumns");
28 dojo.require("dojox.charting.plot2d.StackedAreas");
29 dojo.require("dojox.charting.plot2d.Grid");
30 dojo.require("dojox.charting.plot2d.Indicator");
31
32 dojo.require("dojox.charting.themes.Shrooms");
33 dojo.require("dojox.charting.themes.PlotKit.blue");
34 dojo.require("dojox.charting.themes.PlotKit.cyan");
35 dojo.require("dojox.charting.themes.PlotKit.green");
36 dojo.require("dojox.charting.themes.Ireland");
37 dojo.require("dojox.charting.themes.SageToLime");
38 dojo.require("dojox.charting.themes.Minty");
39 dojo.require("dojox.charting.themes.Tufte");
40
41 dojo.require("dojox.dtl");
42 dojo.require("dojox.dtl.Context");
43 charts = [
44 {
45 description: "Columns, grid and indicators.",
46 makeChart: function(node){
47 (new dojox.charting.Chart(node)).
48 setTheme(dojox.charting.themes.Tufte).
49 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
50 addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }).
51 addPlot("default", { type: "ClusteredColumns", gap: 10, animate: { duration: 1000 } }).
52 addPlot("indicator", { type: "Indicator", values: 1.5, lineStroke: { color: "red" }, precision: 1, animate: { duration: 1000 } }).
53 addPlot("grid", { type: "Grid", vStripes: true, vFill: [200, 0, 0, 0.6], vAlternateFill: [0, 200, 0, 0.6], animate: { duration: 1000 } }).
54 addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ).
55 addSeries("Series B", [ -2, -1, -0.5, 1, 2 ] ).
56 addSeries("Series C", [ 1, 0.5, -1, -2, -3 ] ).
57 addSeries("Series D", [ 0.7, 1.5, -1.2, -1.25, 3 ] ).
58 render();
59 }
60 },
61 {
62 description: "Clustered columns with positive and negative values, readable theme, 1-second animate-in.",
63 makeChart: function(node){
64 (new dojox.charting.Chart(node)).
65 setTheme(dojox.charting.themes.Tufte).
66 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
67 addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }).
68 addPlot("default", { type: "ClusteredColumns", gap: 10, animate: { duration: 1000 } }).
69 addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ).
70 addSeries("Series B", [ -2, -1, -0.5, 1, 2 ] ).
71 addSeries("Series C", [ 1, 0.5, -1, -2, -3 ] ).
72 addSeries("Series D", [ 0.7, 1.5, -1.2, -1.25, 3 ] ).
73 render();
74 }
75 },
76
77 {
78 description: "StackedAreas 3-second animate-in.",
79 makeChart: function(node){
80 (new dojox.charting.Chart(node)).
81 setTheme(dojox.charting.themes.Tufte).
82 addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }).
83 addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }).
84 addPlot("default", { type: "StackedAreas", gap: 10, animate: { duration: 3000 } }).
85 addSeries("Series A", [ 2, 1, 0.5, 1, 1.5 ] ).
86 addSeries("Series B", [ 0, 1, 0.5, 1, 0.5 ] ).
87 addSeries("Series C", [ 1, 0.5, 0, 2, 3 ] ).
88 addSeries("Series D", [ 0.7, 1.5, 1.2, 1.25, 1 ] ).
89 render();
90 }
91 }
92
93
94 ];
95 var now = function(){
96 return (new Date()).getTime();
97 };
98
99
100 dojo.addOnLoad(function(){
101 var defaultStyle = { width: "400px", height: "200px" };
102 var tmpl = new dojox.dtl.Template(dojo.byId("template").value);
103 var context = new dojox.dtl.Context({ charts: charts });
104 dojo.byId("charts").innerHTML = tmpl.render(context);
105
106 dojo.forEach(charts, function(item, idx){
107 var start = now();
108 var n = dojo.byId("chart_"+idx);
109 dojo.style(n, item.style||defaultStyle);
110 item.makeChart(n);
111 console.debug((now()-start), "ms to create:", (idx+1)+":", item.description);
112 });
113 });
114
115 </script>
116 </head>
117 <body>
118 <textarea id="template" style="display: none;">
119 {% for item in charts %}
120 <p>{{ forloop.counter }}: {{ item.description }}</p>
121 <div id="chart_{{ forloop.counter0 }}"></div>
122 {% endfor %}
123 </textarea>
124
125 <h1>Chart 2D: Animation tests</h1>
126
127 <div id="charts"></div>
128 </body>
129 </html>