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