| 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>Chart2D Title</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 22 |
@import "../../../../dijit/themes/tundra/tundra.css"; |
| 23 |
@import "../../resources/Legend.css"; |
| 24 |
|
| 25 |
|
| 26 |
.axisTitleRotation90 { |
| 27 |
transform: rotate(90deg); |
| 28 |
-o-transform: rotate(90deg); |
| 29 |
-webkit-transform: rotate(90deg); |
| 30 |
-moz-transform: rotate(90deg); |
| 31 |
} |
| 32 |
.axisTitleRotation180 { |
| 33 |
transform: rotate(180deg); |
| 34 |
-o-transform: rotate(180deg); |
| 35 |
-webkit-transform: rotate(180deg); |
| 36 |
-moz-transform: rotate(180deg); |
| 37 |
} |
| 38 |
.axisTitleRotation270 { |
| 39 |
transform: rotate(-90deg); |
| 40 |
-o-transform: rotate(-90deg); |
| 41 |
-webkit-transform: rotate(-90deg); |
| 42 |
-moz-transform: rotate(-90deg); |
| 43 |
} |
| 44 |
.pie { |
| 45 |
width:500px; |
| 46 |
height:500px; |
| 47 |
} |
| 48 |
|
| 49 |
</style> |
| 50 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true, has:{'dojo-bidi': true}"></script> |
| 51 |
<script type="text/javascript"> |
| 52 |
dojo.require("dojo.parser"); |
| 53 |
dojo.require("doh.runner"); |
| 54 |
|
| 55 |
dojo.require("dojox.charting.Chart"); |
| 56 |
dojo.require("dojox.charting.axis2d.Default"); |
| 57 |
dojo.require("dojox.charting.plot2d.Lines"); |
| 58 |
dojo.require("dojox.charting.plot2d.Columns"); |
| 59 |
dojo.require("dojox.charting.themes.PlotKit.orange"); |
| 60 |
dojo.require("dojox.charting.action2d.Shake"); |
| 61 |
dojo.require("dojox.charting.action2d.Tooltip"); |
| 62 |
dojo.require("dojox.charting.widget.SelectableLegend"); |
| 63 |
|
| 64 |
dojo.require("dijit.dijit"); |
| 65 |
dojo.require("dojox.charting.widget.Chart"); |
| 66 |
dojo.require("dojox.charting.plot2d.Grid"); |
| 67 |
dojo.require("dojox.data.HtmlStore"); |
| 68 |
dojo.require("dojox.charting.plot2d.Areas"); |
| 69 |
dojo.require("dojox.charting.widget.Legend"); |
| 70 |
|
| 71 |
dojo.require("dojox.charting.plot2d.Pie"); |
| 72 |
dojo.require("dojox.charting.themes.MiamiNice"); |
| 73 |
dojo.require("dojox.charting.action2d.Highlight"); |
| 74 |
|
| 75 |
|
| 76 |
dojo.require("dijit.form.NumberSpinner"); |
| 77 |
dojo.require("dojo.parser"); |
| 78 |
|
| 79 |
var chart1, legend1, pie, pieLegend; |
| 80 |
seriesB = [2.6, 1.8, 2, 1, 1.4, 0.7, 2]; |
| 81 |
|
| 82 |
updateAxis = function(){ |
| 83 |
var gap = 25, |
| 84 |
rotation = 0, |
| 85 |
orientation = "away"; |
| 86 |
chart1.addAxis("x", { |
| 87 |
title: "Quarter \u05dc\u05e9\u05e0\u05ea 2010.", |
| 88 |
titleGap: gap, |
| 89 |
titleFontColor: "orange", |
| 90 |
titleOrientation: orientation, |
| 91 |
rotation: rotation, |
| 92 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 93 |
labels: [ |
| 94 |
{value: 0, text: ""},{value: 1, text: "1 Qtr."},{value: 2, text: "2 Qtr."}, |
| 95 |
{value: 3, text: "3 Qtr."},{value: 4, text: "\u05e8\u05d1\u05e2\u05d5\u05df 4."},{value: 5, text: "End."} |
| 96 |
] |
| 97 |
}). |
| 98 |
addAxis("y", { |
| 99 |
title: "\u05ea\u05e9\u05d5\u05d0\u05d4 \u0028\u05d1\u05de\u05dc\u05d9\u05d5\u05e0\u05d9\u05dd\u0029.", |
| 100 |
titleGap: gap, |
| 101 |
titleFontColor: "orange", |
| 102 |
titleOrientation: orientation, |
| 103 |
rotation: rotation, |
| 104 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 2, |
| 105 |
labels: [ |
| 106 |
{value: 0, text: ""},{value: 1, text: "One."},{value: 2, text: "\u05e9\u05ea\u05d9\u05d9\u05dd."}, |
| 107 |
{value: 3, text: "My name: \u05d8\u05dc."},{value: 4, text: "\u05e7\u05d5\u05e8\u05d0\u05d9\u05dd\u0020\u05dc\u05d9: Tal."},{value: 5, text: "Five."},{value: 6, text: "Six."} |
| 108 |
] |
| 109 |
}). |
| 110 |
addAxis("x2", { |
| 111 |
title: "\u05e8\u05d1\u05e2\u05d5\u05df of 2010.", |
| 112 |
titleGap: gap, |
| 113 |
titleFontColor: "blue", |
| 114 |
titleOrientation: orientation, |
| 115 |
rotation: rotation, |
| 116 |
leftBottom: false, |
| 117 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major" |
| 118 |
}). |
| 119 |
addAxis("y2", { |
| 120 |
title: "Quantity(ton).", |
| 121 |
titleGap: gap, |
| 122 |
titleFontColor: "blue", |
| 123 |
titleOrientation: orientation, |
| 124 |
rotation: rotation, |
| 125 |
leftBottom: false, |
| 126 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 2 |
| 127 |
}); |
| 128 |
var anim6b = new dojox.charting.action2d.Shake(chart1, "default2"); |
| 129 |
var anim6c = new dojox.charting.action2d.Tooltip(chart1, "default2"); |
| 130 |
|
| 131 |
chart1.render(); |
| 132 |
legend1 = new dojox.charting.widget.SelectableLegend({chart: chart1}, "legend1"); |
| 133 |
|
| 134 |
|
| 135 |
}; |
| 136 |
|
| 137 |
makeObjects = function(){ |
| 138 |
chart1 = new dojox.charting.Chart("test1",{textDir:"auto",title:"\u05d0\u05e0\u05d9\u0020\u05db\u05d5\u05ea\u05e8\u05ea of the chart." |
| 139 |
, titleFontColor: "blue"}). |
| 140 |
addPlot("default", {type: "Lines"}). |
| 141 |
addSeries("\u05e1\u05d3\u05e8\u05d4\u0020\u05d0\u0027.", [3, 5, 3, 4, 2], {stroke: {color: "orange"}, fill: "yellow"}).//[{x:3}, {x:5}, {x:3}, {x:4}, {x:2}], {stroke: {color: "orange"}, fill: "yellow"}). |
| 142 |
addPlot("default2", {type: "Columns", gap: 15, hAxis: "x2", vAxis: "y2"}). |
| 143 |
addSeries("Series B.", [{y:12,tooltip:"I'm working at \u05d9\u05d1\u05de in Israel."}, {y:8,tooltip:"\u05d0\u05e0\u05d9\u0020\u05e2\u05d5\u05d1\u05d3\u05ea\u0020\u05d1- IBM \u05d9\u05e9\u05e8\u05d0\u05dc."}, {y:15,tooltip:"I'm working at \u05d9\u05d1\u05de in Israel."}, {y:20,tooltip:"\u05d0\u05e0\u05d9\u0020\u05e2\u05d5\u05d1\u05d3\u05ea\u0020\u05d1- IBM \u05d9\u05e9\u05e8\u05d0\u05dc."}], {plot: "default2", stroke: {color: "blue"}, fill: "lightblue"}); |
| 144 |
updateAxis(); |
| 145 |
pie = new dojox.charting.Chart("pie",{textDir:"rtl"}). |
| 146 |
setTheme(dojox.charting.themes.MiamiNice). |
| 147 |
addPlot("default",{type:"Pie",radius:100,font: "normal normal 10pt Tahoma",htmlLabels:true,labelOffset:-20}). |
| 148 |
addSeries("\u05d0\u05e3\u002e",[{ |
| 149 |
y: 12.1, |
| 150 |
text: "\u05e1\u05d9\u05df\u002e" |
| 151 |
},{ |
| 152 |
y: 9.52, |
| 153 |
text: "India." |
| 154 |
}, { |
| 155 |
y: 2.66, |
| 156 |
text: "USA." |
| 157 |
}, { |
| 158 |
y: 2.06, |
| 159 |
text: "Indonesia." |
| 160 |
}, { |
| 161 |
y: 1.63, |
| 162 |
text: "Brazil." |
| 163 |
},{ |
| 164 |
y: 1.48, |
| 165 |
text: "Russian." |
| 166 |
},{ |
| 167 |
y: 1.29, |
| 168 |
text: "Pakistan." |
| 169 |
},{ |
| 170 |
y: 1.25, |
| 171 |
text: "Japan." |
| 172 |
}]). |
| 173 |
render(); |
| 174 |
var ainm = new dojox.charting.action2d.Highlight(pie,"default"); |
| 175 |
pieLegend = new dojox.charting.widget.SelectableLegend({chart: pie,horizontal:false, outline: true},"pieLegend"); |
| 176 |
}; |
| 177 |
|
| 178 |
dojo.addOnLoad(function(){ |
| 179 |
makeObjects(); |
| 180 |
|
| 181 |
var buttonRtl |
| 182 |
, buttonLtr |
| 183 |
, buttonAuto |
| 184 |
, chart5 |
| 185 |
, legend5; |
| 186 |
|
| 187 |
doh.register("test dynamic change of textDir.", [ |
| 188 |
{ |
| 189 |
name: "initial textDir of the chart", |
| 190 |
|
| 191 |
setUp: function(){ |
| 192 |
buttonRtl = dojo.byId("buttonRtl"); |
| 193 |
buttonLtr = dojo.byId("buttonLtr"); |
| 194 |
buttonAuto = dojo.byId("buttonAuto"); |
| 195 |
chart5 = dijit.byId('chart5'); |
| 196 |
legend5 = dijit.byId('legend5'); |
| 197 |
}, |
| 198 |
|
| 199 |
runTest: function(){ |
| 200 |
doh.is("auto", chart1.textDir, "textDir of : chart1"); |
| 201 |
doh.is("auto", chart1.surface.textDir, "textDir of : chart1.surface"); |
| 202 |
doh.is("auto", legend1.textDir, "textDir of : legend1"); |
| 203 |
|
| 204 |
doh.is("rtl", pie.textDir, "textDir of : pie"); |
| 205 |
doh.is("rtl", pie.surface.textDir, "textDir of : pie.surface"); |
| 206 |
doh.is("rtl", pieLegend.textDir, "textDir of : pieLegend"); |
| 207 |
|
| 208 |
doh.is("ltr", chart5.textDir, "textDir of : chart5"); |
| 209 |
doh.is("ltr", chart5.chart.textDir, "textDir of : chart5"); |
| 210 |
doh.is("ltr", chart5.chart.surface.textDir, "textDir of : chart5.surface"); |
| 211 |
doh.is("ltr", legend5.textDir, "textDir of : legend5"); |
| 212 |
|
| 213 |
} |
| 214 |
}, |
| 215 |
{ |
| 216 |
name: "set textDir to RTL.", |
| 217 |
|
| 218 |
runTest: function(){ |
| 219 |
buttonRtl.click(); |
| 220 |
doh.is("rtl", chart1.textDir, "textDir of : chart"); |
| 221 |
doh.is("rtl", chart1.surface.textDir, "textDir of : chart"); |
| 222 |
doh.is("rtl", legend1.textDir, "textDir of : legend1"); |
| 223 |
|
| 224 |
doh.is("rtl", pie.textDir, "textDir of : pie"); |
| 225 |
doh.is("rtl", pie.surface.textDir, "textDir of : pie.surface"); |
| 226 |
doh.is("rtl", pieLegend.textDir, "textDir of : pieLegend"); |
| 227 |
|
| 228 |
doh.is("rtl", chart5.textDir, "textDir of : chart5"); |
| 229 |
doh.is("rtl", chart5.chart.textDir, "textDir of : chart5"); |
| 230 |
doh.is("rtl", chart5.chart.surface.textDir, "textDir of : chart5.surface"); |
| 231 |
doh.is("rtl", legend5.textDir, "textDir of : legend5"); |
| 232 |
|
| 233 |
} |
| 234 |
}, |
| 235 |
{ |
| 236 |
name: "set textDir to LTR.", |
| 237 |
|
| 238 |
runTest: function(){ |
| 239 |
buttonLtr.click(); |
| 240 |
doh.is("ltr", chart1.textDir, "textDir of : chart"); |
| 241 |
doh.is("ltr", chart1.surface.textDir, "textDir of : chart"); |
| 242 |
doh.is("ltr", legend1.textDir, "textDir of : legend1"); |
| 243 |
|
| 244 |
doh.is("ltr", pie.textDir, "textDir of : pie"); |
| 245 |
doh.is("ltr", pie.surface.textDir, "textDir of : pie.surface"); |
| 246 |
doh.is("ltr", pieLegend.textDir, "textDir of : pieLegend"); |
| 247 |
|
| 248 |
doh.is("ltr", chart5.textDir, "textDir of : chart5"); |
| 249 |
doh.is("ltr", chart5.chart.textDir, "textDir of : chart5"); |
| 250 |
doh.is("ltr", chart5.chart.surface.textDir, "textDir of : chart5.surface"); |
| 251 |
doh.is("ltr", legend5.textDir, "textDir of : legend5"); |
| 252 |
} |
| 253 |
}, |
| 254 |
{ |
| 255 |
name: "set textDir to AUTO.", |
| 256 |
|
| 257 |
runTest: function(){ |
| 258 |
buttonAuto.click(); |
| 259 |
doh.is("auto", chart1.textDir, "textDir of : chart"); |
| 260 |
doh.is("auto", chart1.surface.textDir, "textDir of : chart"); |
| 261 |
doh.is("auto", legend1.textDir, "textDir of : legend1"); |
| 262 |
|
| 263 |
doh.is("auto", pie.textDir, "textDir of : pie"); |
| 264 |
doh.is("auto", pie.surface.textDir, "textDir of : pie.surface"); |
| 265 |
doh.is("auto", pieLegend.textDir, "textDir of : pieLegend"); |
| 266 |
|
| 267 |
doh.is("auto", chart5.textDir, "textDir of : chart5"); |
| 268 |
doh.is("auto", chart5.chart.textDir, "textDir of : chart5"); |
| 269 |
doh.is("auto", chart5.chart.surface.textDir, "textDir of : chart5.surface"); |
| 270 |
doh.is("auto", legend5.textDir, "textDir of : legend5"); |
| 271 |
} |
| 272 |
} |
| 273 |
|
| 274 |
]); |
| 275 |
doh.run(); |
| 276 |
}); |
| 277 |
</script> |
| 278 |
</head> |
| 279 |
<body class="tundra"> |
| 280 |
<h1>Chart2D Titles</h1> |
| 281 |
<p>Column chart with axis title</p> |
| 282 |
<p> |
| 283 |
<input id="buttonRtl" |
| 284 |
onClick=" |
| 285 |
chart1.setTextDir('rtl'); |
| 286 |
dijit.byId('chart5').set('textDir','rtl'); |
| 287 |
pie.setTextDir('rtl'); |
| 288 |
" |
| 289 |
type="button" value="RTL"/> |
| 290 |
<input id="buttonLtr" |
| 291 |
onClick=" |
| 292 |
chart1.setTextDir('ltr'); |
| 293 |
dijit.byId('chart5').set('textDir','ltr'); |
| 294 |
pie.setTextDir('ltr'); |
| 295 |
" |
| 296 |
type="button" value="LTR"/> |
| 297 |
<input id="buttonAuto" |
| 298 |
onClick=" |
| 299 |
chart1.setTextDir('auto'); |
| 300 |
dijit.byId('chart5').set('textDir','auto'); |
| 301 |
pie.setTextDir('auto'); |
| 302 |
" |
| 303 |
type="button" value="AUTO"/> |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
<h2>Programmatically created chart.</h2> |
| 308 |
<div id="legend1"></div> |
| 309 |
<p/> |
| 310 |
<div id="test1" style="width: 600px; height: 400px;"></div> |
| 311 |
|
| 312 |
|
| 313 |
<h2>HTML declared chart.</h2> |
| 314 |
<div dojoType="dojox.data.HtmlStore" dataId="tableExample" data-dojo-id="tableStore"></div> |
| 315 |
<table id="tableExample" style="display: none;"> |
| 316 |
<thead> |
| 317 |
<tr><th>value</th></tr> |
| 318 |
</thead> |
| 319 |
<tbody> |
| 320 |
<tr><td >6.3</td></tr> |
| 321 |
<tr><td>1.8</td></tr> |
| 322 |
<tr><td>3 </td></tr> |
| 323 |
<tr><td>0.5</td></tr> |
| 324 |
<tr><td>4.4</td></tr> |
| 325 |
<tr><td>2.7</td></tr> |
| 326 |
<tr><td>2 </td></tr> |
| 327 |
</tbody> |
| 328 |
</table> |
| 329 |
<table border="0" cellspacing="30"> |
| 330 |
<tr> |
| 331 |
<td> |
| 332 |
<div dojoType="dojox.charting.widget.Chart" id="chart5" textDir="ltr" style="width: 600px; height: 400px;"> |
| 333 |
<div class="axis" name="x" maxLabelCharCount= 2 title="קוראים לי ציר X." titleOrientation= "away" font="italic normal normal 8pt Tahoma" labels="[{value:1, text:'First.'},{value:2, text:'שתיים שלוש.'},{value:4, text:'444444444444ש.'}]"></div> |
| 334 |
<div class="axis" name="y" maxLabelCharCount= 2 title="קוראים לי ציר Y." vertical="true" fixUpper="major" includeZero="true" labels="[{value:2, text:'שתיים שלוש.'},{value:3, text:'Third.'},{value:4, text:'444444444444ש.'}]" |
| 335 |
font="italic normal normal 8pt Tahoma"></div> |
| 336 |
<div class="plot" name="default" type="Areas"></div> |
| 337 |
<div class="plot" name="grid" type="Grid"></div> |
| 338 |
<div class="series" name="סדרה 1." data="1, 2, 0.5, 1.5, 1, 2.8, 0.4"></div> |
| 339 |
<div class="series" name="Run B." array="seriesB" ></div> |
| 340 |
<div class="series" name="Run C." store="tableStore" valueFn="Number(x)"></div> |
| 341 |
</div> |
| 342 |
<div id="legend5" dojoType="dojox.charting.widget.Legend" chartRef="chart5"></div> |
| 343 |
</td> |
| 344 |
</tr> |
| 345 |
</table> |
| 346 |
<h2>3.Pie</h2> |
| 347 |
<div id="pie" class="pie" style="float:left;"></div> |
| 348 |
<div style="float:left;"> |
| 349 |
<div id="pieLegend"></div> |
| 350 |
|
| 351 |
</body> |
| 352 |
</html> |