| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 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>Chart: Selectable Legend test</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 |
</style> |
| 25 |
<style> |
| 26 |
.bars{ |
| 27 |
width:300px; |
| 28 |
height:200px; |
| 29 |
} |
| 30 |
.columns{ |
| 31 |
width:300px; |
| 32 |
height:250px; |
| 33 |
} |
| 34 |
.pie { |
| 35 |
width:500px; |
| 36 |
height:300px; |
| 37 |
} |
| 38 |
.bubble{ |
| 39 |
width:320px; |
| 40 |
height:300px; |
| 41 |
} |
| 42 |
</style> |
| 43 |
|
| 44 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true, has:{'dojo-bidi': true}"></script> |
| 45 |
<script type="text/javascript"> |
| 46 |
dojo.require("dojo.parser"); |
| 47 |
dojo.require("doh.runner"); |
| 48 |
|
| 49 |
dojo.require("dijit.dijit"); |
| 50 |
dojo.require("dojox.charting.Chart"); |
| 51 |
dojo.require("dojox.charting.axis2d.Default"); |
| 52 |
dojo.require("dojox.charting.plot2d.Lines"); |
| 53 |
dojo.require("dojox.charting.plot2d.StackedAreas"); |
| 54 |
dojo.require("dojox.charting.plot2d.Bars"); |
| 55 |
dojo.require("dojox.charting.plot2d.ClusteredBars"); |
| 56 |
dojo.require("dojox.charting.plot2d.StackedBars"); |
| 57 |
dojo.require("dojox.charting.plot2d.Columns"); |
| 58 |
dojo.require("dojox.charting.plot2d.ClusteredColumns"); |
| 59 |
dojo.require("dojox.charting.plot2d.StackedColumns"); |
| 60 |
dojo.require("dojox.charting.plot2d.Bubble"); |
| 61 |
dojo.require("dojox.charting.plot2d.Pie"); |
| 62 |
dojo.require("dojox.charting.themes.MiamiNice"); |
| 63 |
dojo.require("dojox.charting.widget.SelectableLegend"); |
| 64 |
dojo.require("dojox.charting.action2d.Highlight"); |
| 65 |
|
| 66 |
var bars; |
| 67 |
dojo.addOnLoad(function(){ |
| 68 |
bars = new dojox.charting.Chart("bars"). |
| 69 |
setTheme(dojox.charting.themes.MiamiNice). |
| 70 |
addPlot("default",{type: "Bars",gap:2}). |
| 71 |
addAxis("x",{natural: true, includeZero: true}). |
| 72 |
addAxis("y",{natural: true, vertical:true}). |
| 73 |
addSeries("\u05e1\u05d9\u05df\u002e",[1,3,5,7,2,4,6]). |
| 74 |
setDir("rtl"). |
| 75 |
render(); |
| 76 |
var barsLegend = new dojox.charting.widget.SelectableLegend({chart: bars},"barsLegend"); |
| 77 |
|
| 78 |
var linesColumns = new dojox.charting.Chart("linesColumns", {textDir:"rtl"}). |
| 79 |
setTheme(dojox.charting.themes.MiamiNice). |
| 80 |
addPlot("lines",{type: "Lines",markers:true}). |
| 81 |
addPlot("default",{type: "Columns",gap:2}). |
| 82 |
addAxis("y",{natural: true, vertical:true,includeZero: true}). |
| 83 |
addAxis("x",{natural: true,includeZero: true}). |
| 84 |
addSeries("\u05e1\u05d9\u05df\u002e",[2,4,6,8,3,5,7]). |
| 85 |
addSeries("India.",[1,3,5,7,2,4,6],{plot:"lines"}). |
| 86 |
setDir("rtl"). |
| 87 |
render(); |
| 88 |
var linesColumnsLegend = new dojox.charting.widget.SelectableLegend({chart: linesColumns},"linesColumnsLegend"); |
| 89 |
|
| 90 |
var pie = new dojox.charting.Chart("pie",{textDir:"auto"}). |
| 91 |
setTheme(dojox.charting.themes.MiamiNice). |
| 92 |
addPlot("default",{type:"Pie",radius:100,font: "normal normal 10pt Tahoma",htmlLabels:true,labelOffset:-20}). |
| 93 |
addSeries("\u05d0\u05e3\u002e",[{ |
| 94 |
y: 12.1, |
| 95 |
text: "\u05e1\u05d9\u05df\u002e" |
| 96 |
},{ |
| 97 |
y: 9.52, |
| 98 |
text: "India." |
| 99 |
}, { |
| 100 |
y: 2.66, |
| 101 |
text: "USA." |
| 102 |
}, { |
| 103 |
y: 2.06, |
| 104 |
text: "Indonesia." |
| 105 |
}, { |
| 106 |
y: 1.63, |
| 107 |
text: "Brazil." |
| 108 |
},{ |
| 109 |
y: 1.48, |
| 110 |
text: "Russian." |
| 111 |
},{ |
| 112 |
y: 1.29, |
| 113 |
text: "Pakistan." |
| 114 |
},{ |
| 115 |
y: 1.25, |
| 116 |
text: "Japan." |
| 117 |
}]). |
| 118 |
setDir("rtl"). |
| 119 |
render(); |
| 120 |
var ainm = new dojox.charting.action2d.Highlight(pie,"default"); |
| 121 |
var pieLegend = new dojox.charting.widget.SelectableLegend({chart: pie,horizontal:false, outline: true},"pieLegend"); |
| 122 |
|
| 123 |
var bubble = new dojox.charting.Chart("bubble"). |
| 124 |
setTheme(dojox.charting.themes.MiamiNice). |
| 125 |
addPlot("default",{type:"Bubble"}). |
| 126 |
addAxis("x",{natual:true, includeZero: true, max:7}). |
| 127 |
addAxis("y",{natual:true, vertical: true, includeZero: true,max:10}). |
| 128 |
addSeries("\u05e1\u05d9\u05df\u002e",[{x:3,y:5,size:1},{x:1,y:7,size:1},{x:4,y:2,size:3}]). |
| 129 |
addSeries("India.",[{x:5,y:5,size:2},{x:2,y:3,size:4},{x:6,y:2,size:1}]). |
| 130 |
addSeries("C.",[{x:2,y:7,size:3},{x:6,y:8,size:3}]). |
| 131 |
setDir("rtl"). |
| 132 |
render(); |
| 133 |
var bubbleLegend = new dojox.charting.widget.SelectableLegend({chart: bubble, horizontal:false, outline:true},"bubbleLegend"); |
| 134 |
|
| 135 |
doh.register("parse", function(){ |
| 136 |
dojo.parser.parse(); |
| 137 |
}); |
| 138 |
|
| 139 |
doh.register("test textDir", [ |
| 140 |
{ |
| 141 |
name: "textDir inherited", |
| 142 |
|
| 143 |
runTest: function(){ |
| 144 |
doh.is("ltr", bars.textDir, "bars: inherited from GUI"); |
| 145 |
doh.is("rtl", bubble.textDir, "bubble inherited from html container"); |
| 146 |
} |
| 147 |
}, |
| 148 |
{ |
| 149 |
name: "textDir in constructor", |
| 150 |
|
| 151 |
runTest: function(){ |
| 152 |
doh.is("rtl", linesColumns.textDir, "direction of : linesColumns"); |
| 153 |
doh.is("auto", pie.textDir, "direction of : pie"); |
| 154 |
} |
| 155 |
}, |
| 156 |
{ |
| 157 |
name: "textDir of legends", |
| 158 |
|
| 159 |
runTest: function(){ |
| 160 |
doh.is(bars.textDir, barsLegend.textDir, "direction of : barsLegend"); |
| 161 |
doh.is(linesColumns.textDir, linesColumnsLegend.textDir, "direction of : linesColumnsLegend"); |
| 162 |
doh.is(bubble.textDir, bubbleLegend.textDir, "direction of : bubbleLegend"); |
| 163 |
doh.is(pie.textDir, pieLegend.textDir, "direction of : pieLegend"); |
| 164 |
} |
| 165 |
} |
| 166 |
]); |
| 167 |
doh.run(); |
| 168 |
}); |
| 169 |
|
| 170 |
</script> |
| 171 |
</head> |
| 172 |
<body class="claro"> |
| 173 |
<h1>Chart: Selectable Legend</h1> |
| 174 |
<h3>Click the legends</h3> |
| 175 |
<div style="clear:both;"> |
| 176 |
<div style="float:left;"> |
| 177 |
<h2>1.Bars</h2> |
| 178 |
<div id="bars" class="bars"></div> |
| 179 |
<div id="barsLegend"></div> |
| 180 |
</div> |
| 181 |
<div style="float:left;"> |
| 182 |
|
| 183 |
|
| 184 |
<div style="float:left;"> |
| 185 |
<h2>2.Lines&Columns</h2> |
| 186 |
<div id="linesColumns" class="columns"></div> |
| 187 |
<div id="linesColumnsLegend"></div> |
| 188 |
</div> |
| 189 |
</div> |
| 190 |
|
| 191 |
<div style="clear:both;"> |
| 192 |
<div style="float:left;"> |
| 193 |
<h2>3.Pie</h2> |
| 194 |
<div id="pie" class="pie" style="float:left;" ></div> |
| 195 |
<div style="float:left;"> |
| 196 |
<div id="pieLegend"></div> |
| 197 |
</div> |
| 198 |
</div> |
| 199 |
<div style="float:left;margin-left:40px"> |
| 200 |
<h2>4.Bubble</h2> |
| 201 |
<div id="bubble" class="bubble" style="float:left;" dir="rtl"></div> |
| 202 |
<div style="float:left;"> |
| 203 |
<div id="bubbleLegend"></div> |
| 204 |
</div> |
| 205 |
</div> |
| 206 |
</div> |
| 207 |
|
| 208 |
</body> |
| 209 |
</html> |