| 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>Pie 2D</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 22 |
</style> |
| 23 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, has:{'dojo-bidi': true}"></script> |
| 24 |
<script type="text/javascript"> |
| 25 |
|
| 26 |
dojo.require("dojox.charting.Chart"); |
| 27 |
dojo.require("dojox.charting.plot2d.Pie"); |
| 28 |
dojo.require("dojox.charting.themes.PlotKit.blue"); |
| 29 |
dojo.require("dojox.charting.themes.PlotKit.green"); |
| 30 |
dojo.require("dojox.charting.themes.PlotKit.red"); |
| 31 |
dojo.require("dojox.charting.themes.Adobebricks"); |
| 32 |
dojo.require("dojox.charting.themes.Algae"); |
| 33 |
|
| 34 |
makeObjects = function(){ |
| 35 |
var chart1 = new dojox.charting.Chart("test1"); |
| 36 |
chart1.setTheme(dojox.charting.themes.PlotKit.blue); |
| 37 |
chart1.addPlot("default", { |
| 38 |
type: "Pie", |
| 39 |
font: "normal normal bold 12pt Tahoma", |
| 40 |
fontColor: "white", |
| 41 |
labelOffset: 40 |
| 42 |
}); |
| 43 |
chart1.addSeries("Series A", [4, 2, 1, 1]); |
| 44 |
chart1.setDir("rtl"); |
| 45 |
chart1.render(); |
| 46 |
|
| 47 |
var chart2 = new dojox.charting.Chart("test2"); |
| 48 |
chart2.setTheme(dojox.charting.themes.PlotKit.blue); |
| 49 |
chart2.addPlot("default", { |
| 50 |
type: "Pie", |
| 51 |
font: "normal normal bold 12pt Tahoma", |
| 52 |
fontColor: "black", |
| 53 |
labelOffset: -25, |
| 54 |
precision: 0 |
| 55 |
}); |
| 56 |
chart2.addSeries("Series A", [4, 2, 1, 1]); |
| 57 |
chart2.render(); |
| 58 |
|
| 59 |
var chart3 = new dojox.charting.Chart("test3"); |
| 60 |
chart3.setTheme(dojox.charting.themes.PlotKit.green); |
| 61 |
chart3.addPlot("default", { |
| 62 |
type: "Pie", |
| 63 |
font: "normal normal bold 10pt Tahoma", |
| 64 |
fontColor: "white", |
| 65 |
labelOffset: 25, |
| 66 |
radius: 90 |
| 67 |
}); |
| 68 |
chart3.addSeries("Series A", [4, 2, 1, 1]); |
| 69 |
chart3.render(); |
| 70 |
|
| 71 |
var chart4 = new dojox.charting.Chart("test4"); |
| 72 |
chart4.setTheme(dojox.charting.themes.PlotKit.green); |
| 73 |
chart4.addPlot("default", { |
| 74 |
type: "Pie", |
| 75 |
font: "normal normal bold 10pt Tahoma", |
| 76 |
fontColor: "black", |
| 77 |
labelOffset: -25, |
| 78 |
radius: 90 |
| 79 |
}); |
| 80 |
chart4.addSeries("Series A", [4, 2, 1, 1]); |
| 81 |
chart4.render(); |
| 82 |
|
| 83 |
var chart5 = new dojox.charting.Chart("test5"); |
| 84 |
chart5.setTheme(dojox.charting.themes.PlotKit.red); |
| 85 |
chart5.addPlot("default", { |
| 86 |
type: "Pie", |
| 87 |
font: "normal normal bold 14pt Tahoma", |
| 88 |
fontColor: "white", |
| 89 |
labelOffset: 40 |
| 90 |
}); |
| 91 |
chart5.addSeries("Series A", [{y: 4, text: "Red"}, {y: 2, text: "Green"}, {y: 1, text: "Blue"}, {y: 1, text: "Other"}]); |
| 92 |
chart5.render(); |
| 93 |
|
| 94 |
var chart6 = new dojox.charting.Chart("test6"); |
| 95 |
chart6.setTheme(dojox.charting.themes.PlotKit.red); |
| 96 |
chart6.addPlot("default", { |
| 97 |
type: "Pie", |
| 98 |
font: "normal normal bold 14pt Tahoma", |
| 99 |
fontColor: "white", |
| 100 |
labelOffset: 40, |
| 101 |
startAngle: -45 |
| 102 |
}); |
| 103 |
chart6.addSeries("Series A", [ |
| 104 |
{y: 4, text: "Red", color: "red"}, |
| 105 |
{y: 2, text: "Green", color: "green"}, |
| 106 |
{y: 1, text: "Blue", color: "blue"}, |
| 107 |
{y: 1, text: "Other", color: "white", fontColor: "black"} |
| 108 |
]); |
| 109 |
chart6.render(); |
| 110 |
|
| 111 |
var chart7 = new dojox.charting.Chart("test7"); |
| 112 |
chart7.setTheme(dojox.charting.themes.Adobebricks); |
| 113 |
chart7.addPlot("default", { |
| 114 |
type: "Pie", |
| 115 |
font: "normal normal bold 12pt Tahoma", |
| 116 |
fontColor: "white", |
| 117 |
radius: 80 |
| 118 |
}); |
| 119 |
chart7.addSeries("Series A", [4]); |
| 120 |
chart7.render(); |
| 121 |
|
| 122 |
var chart8 = new dojox.charting.Chart("test8"); |
| 123 |
chart8.setTheme(dojox.charting.themes.Algae); |
| 124 |
chart8.addPlot("default", { |
| 125 |
type: "Pie", |
| 126 |
font: "normal normal bold 12pt Tahoma", |
| 127 |
fontColor: "white", |
| 128 |
radius: 80 |
| 129 |
}); |
| 130 |
chart8.addSeries("Series A", [ |
| 131 |
{y: -1, text: "Red", color: "red"}, |
| 132 |
{y: 5, text: "Green", color: "green"}, |
| 133 |
{y: 0, text: "Blue", color: "blue"}, |
| 134 |
{y: 0, text: "Other", color: "white", fontColor: "black"} |
| 135 |
]); |
| 136 |
chart8.render(); |
| 137 |
}; |
| 138 |
|
| 139 |
dojo.addOnLoad(makeObjects); |
| 140 |
|
| 141 |
</script> |
| 142 |
</head> |
| 143 |
<body> |
| 144 |
<h1>Pie 2D</h1> |
| 145 |
|
| 146 |
<p>1: Pie with internal labels.</p> |
| 147 |
<div id="test1" style="width: 300px; height: 300px;"></div> |
| 148 |
<p>2: Pie with external labels and precision=0.</p> |
| 149 |
<div id="test2" style="width: 300px; height: 300px;"></div> |
| 150 |
<p>3/4: Two pies with internal and external labels with a constant radius.</p> |
| 151 |
<table border="1"><tr> |
| 152 |
<td><div id="test3" style="width: 300px; height: 300px;"></div></td> |
| 153 |
<td><div id="test4" style="width: 300px; height: 300px;"></div></td> |
| 154 |
</tr></table> |
| 155 |
<p>5/6: Pie with internal custom labels and custom colors (#6 is rotated).</p> |
| 156 |
<table border="1"><tr> |
| 157 |
<td><div id="test5" style="width: 300px; height: 300px;"></div></td> |
| 158 |
<td><div id="test6" style="width: 300px; height: 300px;"></div></td> |
| 159 |
</tr></table> |
| 160 |
<p>7: Degenerated pie with 1 element.</p> |
| 161 |
<div id="test7" style="width: 200px; height: 200px;"></div> |
| 162 |
<p>8: Degenerated pie with 1 positive elements (out of 5).</p> |
| 163 |
<div id="test8" style="width: 200px; height: 200px;"></div> |
| 164 |
<p>That's all Folks!</p> |
| 165 |
</body> |
| 166 |
</html> |