Debian Codegraph @

dojox/charting/tests/test_plot_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 plot 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"></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
34 dojo.require("dojo.dnd.Source");
35
36 makeObjects = function(){
37 dojo.query("button").style("disabled", true);
38
39 var chart1 = new dojox.charting.Chart("chart1").
40 setTheme(dojox.charting.themes.ThreeD).
41 addAxis("x", {min: 0, max: 10}).
42 addAxis("y", {vertical: true, min: 0, max: 10}).
43 addPlot("Plot 1", {type: "Bubble"}).
44 addSeries("Plot 1 / Series A", [{x: 3, y: 3, size: 4}], {plot: "Plot 1"}).
45 addPlot("Plot 2", {type: "Bubble"}).
46 addSeries("Plot 2 / Series B", [{x: 5, y: 5, size: 4}], {plot: "Plot 2"}).
47 //addSeries("Plot 2 / Series B1", [{x: 5, y: 6, size: 3}], {plot: "Plot 2"}).
48 //addSeries("Plot 2 / Series B2", [{x: 4, y: 4, size: 3}], {plot: "Plot 2"}).
49 //addSeries("Plot 2 / Series B3", [{x: 6, y: 4, size: 3}], {plot: "Plot 2"}).
50 addPlot("Plot 3", {type: "Bubble"}).
51 addSeries("Plot 3 / Series C", [{x: 7, y: 7, size: 4}], {plot: "Plot 3"}).
52 render();
53
54 var legend1 = new dojox.charting.widget.Legend({chart: chart1, horizontal: false}, "legend1");
55 dojo.connect(chart1, "render", legend1, "refresh");
56
57 var plots = new dojo.dnd.Source("dnd1"), noUpdate = false;
58 plots.insertNodes(false, chart1.getPlotOrder());
59 dojo.connect(plots, "onDropInternal", function(){
60 var newOrder = this.getAllNodes().map(function(node){
61 return node.innerHTML;
62 })
63 chart1.setPlotOrder(newOrder);
64 noUpdate = true;
65 chart1.render();
66 noUpdate = false;
67 });
68 dojo.connect(chart1, "render", function(){
69 if(!noUpdate){
70 plots.getAllNodes().orphan();
71 plots.sync();
72 plots.insertNodes(false, chart1.getPlotOrder());
73 }
74 });
75
76 dojo.forEach(["p1", "p2", "p3"], function(id, i){
77 dojo.query("button", id).forEach(function(btn){
78 if(btn.innerHTML == "Front"){
79 dojo.connect(btn, "onclick", function(){
80 chart1.movePlotToFront("Plot " + (i + 1));
81 chart1.render();
82 });
83 }else{
84 dojo.connect(btn, "onclick", function(){
85 chart1.movePlotToBack("Plot " + (i + 1));
86 chart1.render();
87 });
88 }
89 });
90 });
91 };
92
93 dojo.ready(makeObjects);
94
95 </script>
96 </head>
97 <body>
98 <h1>Testing plot order</h1>
99 <!--<p><button onclick="makeObjects();">Go</button></p>-->
100 <p>Chart:</p>
101 <div id="chart1" style="width: 200px; height: 200px;"></div>
102 <div id="legend1"></div>
103 <p id="p1">Plot 1: <button>Front</button> <button>Back</button></p>
104 <p id="p2">Plot 2: <button>Front</button> <button>Back</button></p>
105 <p id="p3">Plot 3: <button>Front</button> <button>Back</button></p>
106 <p>Plots (rearrange using drag-and-drop):</p>
107 <div id="dnd1" class="container"></div>
108 <p>That's all Folks!</p>
109 </body>
110 </html>