-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpieTests.html
230 lines (185 loc) · 6.25 KB
/
pieTests.html
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="Author" content="Leslie Bondaryk" />
<meta name="Owner" content="Pearson" />
<meta name="Copyright" content="Copyright (c) 2013 Pearson. All rights reserved." />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="Carmen Santiago, Demo Book" name="description" />
<title class="setTitle"></title>
<!-- bootstrap_plus.css contains styling for the dropdown menu and other common core styles -->
<link href="css/bootstrap_plus.css" rel="stylesheet" media="screen">
<!-- widgets.css contains styling for the interactive brix -->
<link href="css/widgets.css" rel="stylesheet">
<!-- eCourse-master.css contains styling for all the navigation -->
<link href="css/eCourse-master.css" rel="stylesheet" media="screen">
<!-- content_styles.css contains styling for the narrative layout and responsive design -->
<link href="css/content_styles.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">
<div class="span12 lc_ec_page">
<section class="lc_ec_fiftyFifty lc_ec_pageInner">
<div class="lc_ec_content">
<h2 class="lc_ec_bHead"><span class='number setId'></span>
<span class="setTitle"></span>
</h2>
<div class="lc_ec_leading">
<div id="pie0"><p>0. Pie chart 50/30/20 </p></div>
<div id="pie1"><p>1. Pie chart one wedge 100%</p></div>
<div id="pie2"><p>2. Pie with legend highlights 90/50/5</p></div>
</div>
<div class="lc_ec_trailing">
<div id="pie10"><p>3. Pie and Bar <style color="red">BUG: arcs drawing NANs when appended with scaling</style></p></div>
<div id="pie11"><p>4. Pie with values < 100 20/10</p></div>
<div id="pie12"><p>5. Pie with values < 100 10</p></div>
<div id="pie13"><p>6. Pie with values < 100 80</p></div>
</div>
</div>
</section>
</div>
</div>
<script src="js/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script src="js/jquery.touchSwipe.min.js"></script> -->
<script src="js/jquery-ui-1.10.2.custom.js"></script>
<script src="js/toc-structure.js"></script>
<script src="js/eCourse-master.js"></script>
<script src="js/d3.v3.min.js"></script>
<script src="js/brixlib-compiled.js"></script>
<!--
<script src="../closure/closure-library/closure/goog/base.js"></script>
<script src="../closure/closure-library/closure/goog/deps.js"></script>
<script src="js/eventmanager.js"></script>
<script src="js/widget-base.js"></script>
<script src="js/widget-prototype-axes.js"></script>
<script src="js/widget-image.js"></script>
<script src="js/widget-carousel.js"></script>
<script src="js/widget-imageviewer.js"></script>
<script src="js/widget-labelgroup.js"></script>
<script src="js/widget-callouts.js"></script>
<script src="js/widget-legend.js"></script>
<script src="js/widget-markergroup.js"></script>
<script src="js/widget-barchart.js"></script>
<script src="js/widget-linegraph.js"></script>
<script src="js/widget-piechart.js"></script>
-->
<script>
// local aliases for convenience
var EventManager = pearson.utils.EventManager;
var Rect = pearson.utils.Rect;
var Size = pearson.utils.Size;
var SVGContainer = pearson.brix.SVGContainer;
var Image = pearson.brix.Image;
var CaptionedImage = pearson.brix.CaptionedImage;
var Carousel = pearson.brix.Carousel;
var ImageViewer = pearson.brix.ImageViewer;
var Callouts = pearson.brix.Callouts;
var LabelGroup = pearson.brix.LabelGroup;
var MarkerGroup = pearson.brix.MarkerGroup;
var BarChart = pearson.brix.BarChart;
var LineGraph = pearson.brix.LineGraph;
var PieChart = pearson.brix.PieChart;
var Legend = pearson.brix.Legend;
var eventManager = new EventManager();
var cheeses = [{x: 65, y: "Cheddar"},
{x: 10, y: "roquefort"},
{x: 20, y: "brie"},
{x: 5, y: "venezuelan beaver cheese"}];
// <div id="widgetTarget0"><p>0. Single pie chart</p></div>
var svg0 = new SVGContainer(
{node: d3.select("#pie0"),
maxWid: 470,
maxHt: 200
}
);
var pie0 = new PieChart ({
Data:cheeses,
});
svg0.append(pie0);
// <div id="pie1"><p>1.pie chart one wedge 100%</p></div>
var svg1 = new SVGContainer(
{node: d3.select("#pie1"),
maxWid: 570,
maxHt: 120
}
);
var pie1 = new PieChart({
Data:[{x:100, y: "the whole pie"}],
}
);
svg1.append(pie1);
// <div id="widgetTarget2"><p>Pie with legend (events)</p></div>
var svg2 = new SVGContainer(
{node: d3.select("#pie2"),
maxWid: 570,
maxHt: 200
});
var pie2 = new PieChart({
Data:[{x: 5, y: "pork"},
{x: 50, y: "banana"},
{x: 90, y: "chocolate"}],
});
svg2.append(pie2);
// <div id="pie10"><p>pie and bar and legend</p></div>
var svg70 = new SVGContainer(
{node: d3.select("#pie10"),
maxWid: 570,
maxHt: 300
}
);
var ordinalData = [
{x: 45, y: "Levo"},
{x: 55, y: "Dextro"}];
var bar0 = new BarChart({
Data: [[ordinalData[0]], [ordinalData[1]]],
xAxisFormat: { type: "linear",
ticks: [0,10,20,30,40,50,60,70,80,90,100],
orientation: "bottom",
//mode: "reverse",
label: "% enantiomers" },
yAxisFormat: { type: "ordinal",
orientation: "left",
},
});
svg70.append(bar0, {topPercentOffset: 0, leftPercentOffset: 0, heightPercent: 1, widthPercent: 0.7});
svg70.append(new PieChart({
Data: ordinalData,
}), {topPercentOffset: 0, leftPercentOffset: 0.5, heightPercent: 0.5, widthPercent: 0.5});
// <div id="pie11"><p>5. Pie with values <100 20/10</p></div>
var svg5 = new SVGContainer(
{node: d3.select("#pie11"),
maxWid: 370,
maxHt:200
}
);
var pie5 = new PieChart({
Data: [{x: 20, y: "only20"},{x: 10, y: "only10"}],
});
svg5.append(pie5);
// <div id="pie11"><p>6. Pie with values <100 10</p></div>
var svg6 = new SVGContainer(
{node: d3.select("#pie12"),
maxWid: 570,
maxHt:150
}
);
var pie6 = new PieChart({
Data: [{x: 10, y: "little wedge"}],
});
svg6.append(pie6);
// <div id="pie13"><p>7. Pie with values <100 80</p></div>
var svg7 = new SVGContainer(
{node: d3.select("#pie13"),
maxWid: 370,
maxHt:150
}
);
var pie7 = new PieChart({
Data: [{x: 80, y: "big wedge"}],
});
svg7.append(pie7);
</script>
</body>
</html>