summaryrefslogtreecommitdiff
path: root/includes/js/dojox/charting/tests/test_pie2d.html
blob: 9fe6827f1a404383fa9a02b4da979708cee21e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<html>
<head>
<title>Pie 2D</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
	@import "../../../dojo/resources/dojo.css";
	@import "../../../dijit/tests/css/dijitTests.css";
</style>
<!--
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
<script type="text/javascript" src="Silverlight.js"></script>
-->
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="../../lang/functional.js"></script>
<script type="text/javascript" src="../../lang/functional/fold.js"></script>
<script type="text/javascript" src="../../lang/utils.js"></script>
<script type="text/javascript" src="../Theme.js"></script>
<script type="text/javascript" src="../scaler.js"></script>
<script type="text/javascript" src="../Element.js"></script>
<script type="text/javascript" src="../plot2d/Pie.js"></script>
<script type="text/javascript" src="../Chart2D.js"></script>
<script type="text/javascript">

dojo.require("dojox.charting.Chart2D");
dojo.require("dojox.charting.themes.PlotKit.blue");
dojo.require("dojox.charting.themes.PlotKit.green");
dojo.require("dojox.charting.themes.PlotKit.red");

makeObjects = function(){
	var chart1 = new dojox.charting.Chart2D("test1");
	chart1.setTheme(dojox.charting.themes.PlotKit.blue);
	chart1.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 12pt Tahoma", 
		fontColor: "white", 
		labelOffset: 40
	});
	chart1.addSeries("Series A", [4, 2, 1, 1]);
	chart1.render();

	var chart2 = new dojox.charting.Chart2D("test2");
	chart2.setTheme(dojox.charting.themes.PlotKit.blue);
	chart2.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 12pt Tahoma", 
		fontColor: "black", 
		labelOffset: -25,
		precision: 0
	});
	chart2.addSeries("Series A", [4, 2, 1, 1]);
	chart2.render();

	var chart3 = new dojox.charting.Chart2D("test3");
	chart3.setTheme(dojox.charting.themes.PlotKit.green);
	chart3.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 10pt Tahoma", 
		fontColor: "white", 
		labelOffset: 25, 
		radius: 90
	});
	chart3.addSeries("Series A", [4, 2, 1, 1]);
	chart3.render();

	var chart4 = new dojox.charting.Chart2D("test4");
	chart4.setTheme(dojox.charting.themes.PlotKit.green);
	chart4.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 10pt Tahoma", 
		fontColor: "black", 
		labelOffset: -25, 
		radius: 90
	});
	chart4.addSeries("Series A", [4, 2, 1, 1]);
	chart4.render();

	var chart5 = new dojox.charting.Chart2D("test5");
	chart5.setTheme(dojox.charting.themes.PlotKit.red);
	chart5.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 14pt Tahoma", 
		fontColor: "white", 
		labelOffset: 40
	});
	chart5.addSeries("Series A", [{y: 4, text: "Red"}, {y: 2, text: "Green"}, {y: 1, text: "Blue"}, {y: 1, text: "Other"}]);
	chart5.render();

	var chart6 = new dojox.charting.Chart2D("test6");
	chart6.setTheme(dojox.charting.themes.PlotKit.red);
	chart6.addPlot("default", {
		type: "Pie", 
		font: "normal normal bold 14pt Tahoma", 
		fontColor: "white", 
		labelOffset: 40
	});
	chart6.addSeries("Series A", [
		{y: 4, text: "Red", color: "red"},
		{y: 2, text: "Green", color: "green"},
		{y: 1, text: "Blue", color: "blue"},
		{y: 1, text: "Other", color: "white", fontColor: "black"}
	]);
	chart6.render();
};

dojo.addOnLoad(makeObjects);

</script>
</head>
<body>
<h1>Pie 2D</h1>
<!--<p><button onclick="makeObjects();">Go</button></p>-->
<p>1: Pie with internal labels.</p>
<div id="test1" style="width: 300px; height: 300px;"></div>
<p>2: Pie with external labels and precision=0.</p>
<div id="test2" style="width: 300px; height: 300px;"></div>
<p>3/4: Two pies with internal and external labels with a constant radius.</p>
<table border="1"><tr>
	<td><div id="test3" style="width: 300px; height: 300px;"></div></td>
	<td><div id="test4" style="width: 300px; height: 300px;"></div></td>
</tr></table>
<p>5/6: Pie with internal custom labels and custom colors.</p>
<table border="1"><tr>
	<td><div id="test5" style="width: 300px; height: 300px;"></div></td>
	<td><div id="test6" style="width: 300px; height: 300px;"></div></td>
</tr></table>
<p>That's all Folks!</p>
</body>
</html>