| 1 |
<!DOCTYPE HTML> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 |
<title>Pie 2D</title> |
| 6 |
<style type="text/css"> |
| 7 |
@import "../../../dojo/resources/dojo.css"; |
| 8 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 9 |
</style> |
| 10 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true"></script> |
| 11 |
<script type="text/javascript"> |
| 12 |
require([ |
| 13 |
"dojox/charting/Chart", |
| 14 |
"dojox/charting/plot2d/Pie", |
| 15 |
"dojox/charting/themes/PlotKit/blue", |
| 16 |
"dojox/charting/themes/PlotKit/green", |
| 17 |
"dojox/charting/themes/PlotKit/red", |
| 18 |
"dojox/charting/themes/Adobebricks", |
| 19 |
"dojox/charting/themes/Algae", |
| 20 |
"dojox/charting/themes/Claro", |
| 21 |
"dojo/domReady!" |
| 22 |
], function(Chart, Pie, pkBlue, pkGreen, pkRed, Adobebricks, Algae, Claro){ |
| 23 |
var chart1 = new Chart("test1"); |
| 24 |
chart1.setTheme(pkBlue); |
| 25 |
chart1.addPlot("default", { |
| 26 |
type: Pie, |
| 27 |
font: "normal normal bold 12pt Tahoma", |
| 28 |
fontColor: "white", |
| 29 |
labelOffset: 40 |
| 30 |
}); |
| 31 |
chart1.addSeries("Series A", [4, 2, 1, 1]); |
| 32 |
chart1.render(); |
| 33 |
|
| 34 |
var chart2 = new Chart("test2"); |
| 35 |
chart2.setTheme(pkBlue); |
| 36 |
chart2.addPlot("default", { |
| 37 |
type: Pie, |
| 38 |
font: "normal normal bold 12pt Tahoma", |
| 39 |
fontColor: "black", |
| 40 |
labelOffset: -25, |
| 41 |
precision: 0 |
| 42 |
}); |
| 43 |
chart2.addSeries("Series A", [4, 2, 1, 1]); |
| 44 |
chart2.render(); |
| 45 |
|
| 46 |
var chart3 = new Chart("test3"); |
| 47 |
chart3.setTheme(pkBlue); |
| 48 |
chart3.addPlot("default", { |
| 49 |
font: "normal normal bold 12pt Tahoma", |
| 50 |
fontColor: "black", |
| 51 |
htmlLabels: true, |
| 52 |
labelStyle: "columns", |
| 53 |
labels: true, |
| 54 |
precision: 0, |
| 55 |
radius: 75, |
| 56 |
startAngle: -10, |
| 57 |
type: Pie |
| 58 |
}); |
| 59 |
chart3.addSeries("Series A", [ |
| 60 |
{ y: 52.39, text: "Chrome" }, |
| 61 |
{ y: 14.4, text: "Safari" }, |
| 62 |
{ y: 8.55, text: "UC Browser" }, |
| 63 |
{ y: 6.73, text: "Firefox" }, |
| 64 |
{ y: 4.37, text: "IE" }, |
| 65 |
{ y: 3.78, text: "Opera" }, |
| 66 |
{ y: 3.24, text: "Samsung" }, |
| 67 |
{ y: 1.77, text: "Edge" }, |
| 68 |
{ y: 0, text: "Other" } |
| 69 |
]); |
| 70 |
chart3.render(); |
| 71 |
|
| 72 |
var chart4 = new Chart("test4"); |
| 73 |
chart4.setTheme(pkGreen); |
| 74 |
chart4.addPlot("default", { |
| 75 |
type: Pie, |
| 76 |
font: "normal normal bold 10pt Tahoma", |
| 77 |
fontColor: "white", |
| 78 |
labelOffset: 25, |
| 79 |
radius: 90 |
| 80 |
}); |
| 81 |
chart4.addSeries("Series A", [4, 2, 1, 1]); |
| 82 |
chart4.render(); |
| 83 |
|
| 84 |
var chart5 = new Chart("test5"); |
| 85 |
chart5.setTheme(pkGreen); |
| 86 |
chart5.addPlot("default", { |
| 87 |
type: Pie, |
| 88 |
font: "normal normal bold 10pt Tahoma", |
| 89 |
fontColor: "black", |
| 90 |
labelOffset: -25, |
| 91 |
radius: 90 |
| 92 |
}); |
| 93 |
chart5.addSeries("Series A", [4, 2, 1, 1]); |
| 94 |
chart5.render(); |
| 95 |
|
| 96 |
var chart6 = new Chart("test6"); |
| 97 |
chart6.setTheme(pkRed); |
| 98 |
chart6.addPlot("default", { |
| 99 |
type: Pie, |
| 100 |
font: "normal normal bold 14pt Tahoma", |
| 101 |
fontColor: "white", |
| 102 |
labelOffset: 40 |
| 103 |
}); |
| 104 |
chart6.addSeries("Series A", [{ |
| 105 |
y: 4, |
| 106 |
text: "Red" |
| 107 |
}, { |
| 108 |
y: 2, |
| 109 |
text: "Green" |
| 110 |
}, { |
| 111 |
y: 1, |
| 112 |
text: "Blue" |
| 113 |
}, { |
| 114 |
y: 1, |
| 115 |
text: "Other" |
| 116 |
}]); |
| 117 |
chart6.render(); |
| 118 |
|
| 119 |
var chart7 = new Chart("test7"); |
| 120 |
chart7.setTheme(pkRed); |
| 121 |
chart7.addPlot("default", { |
| 122 |
type: Pie, |
| 123 |
font: "normal normal bold 14pt Tahoma", |
| 124 |
fontColor: "black", |
| 125 |
labelOffset: 40, |
| 126 |
startAngle: -45 |
| 127 |
}); |
| 128 |
chart7.addSeries("Series A", [{ |
| 129 |
y: 4, |
| 130 |
text: "Red", |
| 131 |
color: "red" |
| 132 |
}, { |
| 133 |
y: 2, |
| 134 |
text: "Green", |
| 135 |
color: "green" |
| 136 |
}, { |
| 137 |
y: 1, |
| 138 |
text: "Blue", |
| 139 |
color: "blue" |
| 140 |
}, { |
| 141 |
y: 1, |
| 142 |
text: "Other", |
| 143 |
color: "white", |
| 144 |
fontColor: "black" |
| 145 |
}]); |
| 146 |
chart7.render(); |
| 147 |
|
| 148 |
var chart8 = new Chart("test8"); |
| 149 |
chart8.setTheme(Adobebricks); |
| 150 |
chart8.addPlot("default", { |
| 151 |
type: Pie, |
| 152 |
font: "normal normal bold 12pt Tahoma", |
| 153 |
fontColor: "white", |
| 154 |
radius: 80 |
| 155 |
}); |
| 156 |
chart8.addSeries("Series A", [4]); |
| 157 |
chart8.render(); |
| 158 |
|
| 159 |
var chart9 = new Chart("test9"); |
| 160 |
chart9.setTheme(Algae); |
| 161 |
chart9.addPlot("default", { |
| 162 |
type: Pie, |
| 163 |
font: "normal normal bold 12pt Tahoma", |
| 164 |
fontColor: "white", |
| 165 |
radius: 80 |
| 166 |
}); |
| 167 |
chart9.addSeries("Series A", [{ |
| 168 |
y: -1, |
| 169 |
text: "Red", |
| 170 |
color: "red" |
| 171 |
}, { |
| 172 |
y: 5, |
| 173 |
text: "Green", |
| 174 |
color: "green" |
| 175 |
}, { |
| 176 |
y: 0, |
| 177 |
text: "Blue", |
| 178 |
color: "blue" |
| 179 |
}, { |
| 180 |
y: 0, |
| 181 |
text: "Other", |
| 182 |
color: "white", |
| 183 |
fontColor: "black" |
| 184 |
}]); |
| 185 |
chart9.render(); |
| 186 |
|
| 187 |
var chart10 = new Chart("test10"); |
| 188 |
chart10.setTheme(Claro); |
| 189 |
chart10.addPlot("default", { |
| 190 |
type: Pie, |
| 191 |
font: "normal normal bold 12pt Tahoma", |
| 192 |
fontColor: "white", |
| 193 |
radius: 80 |
| 194 |
}); |
| 195 |
chart10.addSeries("Series A", []); |
| 196 |
chart10.render(); |
| 197 |
|
| 198 |
var chart11 = new Chart("test11"); |
| 199 |
chart11.setTheme(Claro); |
| 200 |
chart11.addPlot("default", { |
| 201 |
type: Pie, |
| 202 |
font: "normal normal bold 12pt Tahoma", |
| 203 |
fontColor: "white", |
| 204 |
radius: 80, |
| 205 |
zeroDataMessage: "No Non-Zero Data" |
| 206 |
}); |
| 207 |
chart11.addSeries("Series A", []); |
| 208 |
chart11.render(); |
| 209 |
|
| 210 |
var chart12 = new Chart("test12"); |
| 211 |
chart12.setTheme(Claro); |
| 212 |
chart12.addPlot("default", { |
| 213 |
type: Pie, |
| 214 |
font: "normal normal bold 12pt Tahoma", |
| 215 |
fontColor: "white", |
| 216 |
radius: 80, |
| 217 |
zeroDataMessage: "No Non-Zero Data" |
| 218 |
}); |
| 219 |
chart12.addSeries("Series A", [{ |
| 220 |
y: 0, |
| 221 |
text: "Red", |
| 222 |
color: "red" |
| 223 |
}, { |
| 224 |
y: 0, |
| 225 |
text: "Green", |
| 226 |
color: "green" |
| 227 |
}, { |
| 228 |
y: 0, |
| 229 |
text: "Blue", |
| 230 |
color: "blue" |
| 231 |
}, { |
| 232 |
y: 0, |
| 233 |
text: "Other", |
| 234 |
color: "white", |
| 235 |
fontColor: "black" |
| 236 |
}]); |
| 237 |
chart12.render(); |
| 238 |
}); |
| 239 |
</script> |
| 240 |
</head> |
| 241 |
<body> |
| 242 |
<h1>Pie 2D</h1> |
| 243 |
|
| 244 |
<p>1: Pie with internal labels.</p> |
| 245 |
<div id="test1" style="width: 300px; height: 300px;"></div> |
| 246 |
<p>2: Pie with external labels and precision=0.</p> |
| 247 |
<div id="test2" style="width: 300px; height: 300px;"></div> |
| 248 |
<p>3: Pie with `labelStyle="columns"`, a constant radius, and a `0` plot value.</p> |
| 249 |
<div id="test3" style="width: 400px; height: 400px;"></div> |
| 250 |
<p>4/5: Two pies with internal and external labels with a constant radius.</p> |
| 251 |
<table border="1"> |
| 252 |
<tr> |
| 253 |
<td> |
| 254 |
<div id="test4" style="width: 300px; height: 300px;"></div> |
| 255 |
</td> |
| 256 |
<td> |
| 257 |
<div id="test5" style="width: 300px; height: 300px;"></div> |
| 258 |
</td> |
| 259 |
</tr> |
| 260 |
</table> |
| 261 |
<p>6/7: Pie with internal custom labels and custom colors (#7 is rotated).</p> |
| 262 |
<table border="1"> |
| 263 |
<tr> |
| 264 |
<td> |
| 265 |
<div id="test6" style="width: 300px; height: 300px;"></div> |
| 266 |
</td> |
| 267 |
<td> |
| 268 |
<div id="test7" style="width: 300px; height: 300px;"></div> |
| 269 |
</td> |
| 270 |
</tr> |
| 271 |
</table> |
| 272 |
<p>8: Degenerated pie with 1 element.</p> |
| 273 |
<div id="test8" style="width: 200px; height: 200px;"></div> |
| 274 |
<p>9: Degenerated pie with 1 positive elements (out of 5).</p> |
| 275 |
<div id="test9" style="width: 200px; height: 200px;"></div> |
| 276 |
<p>10: Pie with no data.</p> |
| 277 |
<div id="test10" style="width: 200px; height: 200px;"></div> |
| 278 |
<p>11: Pie with all data zero (no data).</p> |
| 279 |
<div id="test11" style="width: 200px; height: 200px;"></div> |
| 280 |
<p>12: Pie with all data zero (no data) and a message.</p> |
| 281 |
<div id="test12" style="width: 200px; height: 200px;"></div> |
| 282 |
<p>That's all Folks!</p> |
| 283 |
</body> |
| 284 |
</html> |