Debian Codegraph @

dojox/charting/tests/BidiSupport/mirror_series_order.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>Testing series order</title>
19 <style type="text/css">
20 @import "../../../../dojo/resources/dojo.css";
21 @import "../../../../dojo/resources/dnd.css";
22 @import "../../../../dojo/tests/dnd/dndDefault.css";
23 @import "../../../../dijit/tests/css/dijitTests.css";
24 </style>
25 <script src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, has:{'dojo-bidi': true}"></script>
26 <script>
27
28 dojo.require("dojox.charting.Chart");
29 dojo.require("dojox.charting.axis2d.Default");
30 dojo.require("dojox.charting.plot2d.Bubble");
31 dojo.require("dojox.charting.themes.ThreeD");
32 dojo.require("dojox.charting.widget.Legend");
33 dojo.require("dojo.dnd.Source");
34
35 makeObjects = function(){
36 dojo.query("button").style("disabled", true);
37
38 var chart1 = new dojox.charting.Chart("chart1").
39 setTheme(dojox.charting.themes.ThreeD).
40 addAxis("x", {min: 0, max: 10}).
41 addAxis("y", {vertical: true, min: 0, max: 10}).
42 addPlot("Plot 1", {type: "Bubble"}).
43 addSeries("Series A", [{x: 3, y: 3, size: 4}], {plot: "Plot 1", color: "red"}).
44 addSeries("Series B", [{x: 5, y: 5, size: 4}], {plot: "Plot 1", color: "green"}).
45 addSeries("Series C", [{x: 7, y: 7, size: 4}], {plot: "Plot 1", color: "blue"}).
46 setDir("rtl").
47 render();
48
49 var series = new dojo.dnd.Source("dnd1"), noUpdate = false;
50 series.insertNodes(false, chart1.getSeriesOrder("Plot 1"));
51 dojo.connect(series, "onDropInternal", function(){
52 var newOrder = this.getAllNodes().map(function(node){
53 return node.innerHTML;
54 })
55 chart1.setSeriesOrder(newOrder);
56 noUpdate = true;
57 chart1.render();
58 noUpdate = false;
59 });
60 dojo.connect(chart1, "render", function(){
61 if(!noUpdate){
62 series.getAllNodes().orphan();
63 series.sync();
64 series.insertNodes(false, chart1.getSeriesOrder("Plot 1"));
65 }
66 });
67
68 dojo.forEach(["s1", "s2", "s3"], function(id, i){
69 dojo.query("button", id).forEach(function(btn){
70 if(btn.innerHTML == "Front"){
71 dojo.connect(btn, "onclick", function(){
72 chart1.moveSeriesToFront("Series " + "ABCDEFG".charAt(i));
73 chart1.render();
74 });
75 }else{
76 dojo.connect(btn, "onclick", function(){
77 chart1.moveSeriesToBack("Series " + "ABCDEFG".charAt(i));
78 chart1.render();
79 });
80 }
81 });
82 });
83 };
84
85 dojo.ready(makeObjects);
86
87 </script>
88 </head>
89 <body>
90 <h1>Testing series order</h1>
91 <!--<p><button onclick="makeObjects();">Go</button></p>-->
92 <p>Chart:</p>
93 <div id="chart1" style="width: 200px; height: 200px;"></div>
94 <div id="legend1"></div>
95 <p id="s1">Series A: <button>Front</button> <button>Back</button></p>
96 <p id="s2">Series B: <button>Front</button> <button>Back</button></p>
97 <p id="s3">Series C: <button>Front</button> <button>Back</button></p>
98 <p>Series (rearrange using drag-and-drop):</p>
99 <div id="dnd1" class="container"></div>
100 <p>That's all Folks!</p>
101 </body>
102 </html>