This repository has been archived by the owner on Jun 28, 2020. It is now read-only.
forked from lbondaryk/PlayerProto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
axesTests.html
363 lines (339 loc) · 7.43 KB
/
axesTests.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<!DOCTYPE html>
<html>
<head>
<title class="setTitle"></title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="eCourses Author, Title" name="description">
<!-- Bootstrap -->
<link href="css/bootstrap_plus.css" rel="stylesheet" media="screen">
<link href="css/graphics_and_svg.css" rel="stylesheet">
<link href="css/learning-objective.css" rel="stylesheet">
<link href="css/eCourse-master.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span6 leftCol">
<h2 class="setTitle"></h2>
<div id="widgetTarget0"><p>0. SVG Container Created 400 wide by 100 high</p></div>
<div id="widgetTarget1"><p>1. SVG Container with x axis only</p></div>
<div id="widgetTarget2"><p>2. SVG Container with y axis only</p></div>
<div id="widgetTarget3"><p>3. x-y on the top and right sides</p></div>
<div id="widgetTarget4"><p>4. x-y axes with no labels</p></div>
<div id="widgetTarget5"><p>5. (2) x-y axes starting top left and center using half of each dimension</p></div>
<div id="widgetTarget6"><p>6. x-y axes with explicit ticks</p></div>
<div id="widgetTarget7"><p>7. x-y axes with no ticks</p></div>
<div id="widgetTarget8"><p>8. x-y axes with no data (0 to 1 default)</p></div>
</div>
<div class="span6 rightCol">
<div id="widgetTarget50"><p>9. x-y log scale x and linear y</p></div>
<div id="widgetTarget60"><p>10. x-y linear scale x and ordinal y</p></div>
</div>
</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/widgets.js"></script>
<script>
var testData = [
{ x: 0,
y: 0
},
{ x: 5,
y: 5
},
{ x: 1000,
y: 1000}
];
var ordinalData = [
{ x: 34.7,
y: "tabloids"
},
{ x: 23.9,
y: "periodicals"
},
{ x: 41.2,
y: "novellas"}
];
var logData = [
{ x: 1,
y: 0.0011
},
{ x: 150,
y: 0.02
},
{ x: 500,
y: 0.2
},
{ x: 1300,
y: 0.36
},
{ x: 1400,
y: 0.34
},
{ x: 1500,
y: 0.425
},
{ x: 1600,
y: 0.545
},
{ x: 1700,
y: 0.61
},
{ x: 1750,
y: 0.7
},
{ x: 1800,
y: 0.9
},
{ x: 1850,
y: 1.128
},
{ x: 1900,
y: 1.55
},
{ x: 1910,
y: 1.75
},
{ x: 1920,
y: 1.86
},
{ x: 1925,
y: 2.0
},
{ x: 1940,
y: 2.3
},
{ x: 1950,
y: 2.529346
},
{ x: 1960,
y: 3.023358
},
{ x: 1965,
y: 3.33167
},
{ x: 1970,
y: 3.685777
},
{ x: 1974,
y: 4.00
},
{ x: 1980,
y: 4.437609
},
{ x: 1985,
y: 4.846247
},
{ x: 1990,
y: 5.290452
},
{ x: 1996,
y: 6.00
},
{ x: 2000,
y: 6.115367
},
{ x: 2005,
y: 6.512276
},
{ x: 2010,
y: 6.908688
}
]; // array of line data
//<div id="widgetTarget0"><p>0. SVG Container Created 400 wide by 100 high</p></div>
var svg0 = new MakeSVGContainer(
{node: d3.select("#widgetTarget0"),
maxWid: 400,
maxHt: 100
}
);
//<div id="widgetTarget1"><p>1. SVG Container with x axis only</p></div>
var svg1 = new MakeSVGContainer(
{node: d3.select("#widgetTarget1"),
maxWid: 400,
maxHt: 150
}
);
svg1.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 1, yPerc: 1,//full height and width
Data: [testData],
xaxisType: "linear",
xTicks: 5,
xOrient: "bottom",
xLabel: "an x axis on bottom"
});
//<div id="widgetTarget2"><p>2. SVG Container with y axis only</p></div>
var svg2 = new MakeSVGContainer(
{node: d3.select("#widgetTarget2"),
maxWid: 400,
maxHt: 200
}
);
svg2.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 1, yPerc: 1,//full height and width
Data: [testData],
yaxisType: "linear",
yTicks: 5,
yOrient: "left",
yLabel: "a y axis on the left"
});
//<div id="widgetTarget3"><p>3. x-y on the top and right sides</p></div>
var svg3 = new MakeSVGContainer(
{node: d3.select("#widgetTarget3"),
maxWid: 400,
maxHt: 200
}
);
svg3.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 1, yPerc: 1,//full height and width
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: 3,
xOrient: "top",
xLabel: "x axis on the top",
yTicks: 5,
yOrient: "right",
yLabel: "a y axis on the right"
});
// <div id="widgetTarget4"><p>4. x-y axes with no labels</p></div>
var svg4 = new MakeSVGContainer(
{node: d3.select("#widgetTarget4"),
maxWid: 400,
maxHt: 200
}
);
svg4.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 1, yPerc: 1,//full height and width
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: 3,
xOrient: "bottom",
yTicks: 10,
yOrient: "left",
});
//<div id="widgetTarget5"><p>5.(2) x-y axes starting top left and center using half of each dimension</p></div>
var svg5 = new MakeSVGContainer(
{node: d3.select("#widgetTarget5"),
maxWid: 400,
maxHt: 200
}
);
svg5.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 0.5, yPerc: 0.5,//full height and width
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: 3,
xOrient: "bottom",
yTicks: 3,
yOrient: "left",
});
svg5.Axes({
xPosPerc: .5, yPosPerc:.5, //top, left corner
xPerc: 0.5, yPerc: 0.5,//full height and width
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: 3,
xOrient: "bottom",
yTicks: 3,
yOrient: "right",
});
//<div id="widgetTarget6"><p>6. x-y axes with explicit ticks</p></div>
var svg6 = new MakeSVGContainer(
{node: d3.select("#widgetTarget6"),
maxWid: 400,
maxHt: 200
}
);
svg6.Axes({
id: 6,
xPosPerc: .1, yPosPerc:.1,
xPerc: 0.8, yPerc: 0.8,
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: [-10,3,8],
xOrient: "bottom",
yTicks: [-10,10],
yOrient: "left",
});
//<div id="widgetTarget7"><p>7. x-y axes with no ticks</p></div>
var svg7 = new MakeSVGContainer(
{node: d3.select("#widgetTarget7"),
maxWid: 400,
maxHt: 200
}
);
svg7.Axes({
xPosPerc: 0, yPosPerc:0, //top, left corner
xPerc: 1, yPerc: 1,//full height and width
Data: [testData],
xaxisType: "linear", yaxisType: "linear",
xTicks: 0,
xOrient: "bottom",
yTicks: [],
yOrient: "left",
});
//<div id="widgetTarget8"><p>8. x-y axes with no data (0 to 1 default)</p></div>
var svg8 = new MakeSVGContainer(
{node: d3.select("#widgetTarget8"),
maxWid: 400,
maxHt: 200
}
);
svg8.Axes({
xPosPerc: 0, yPosPerc:0,
xPerc: 1, yPerc: 1,
xaxisType: "linear", yaxisType: "linear",
xTicks:2,
xOrient: "bottom",
yTicks: 2,
yOrient: "left",
});
var svg50 = new MakeSVGContainer(
{node: d3.select("#widgetTarget50"),
maxWid: 400,
maxHt: 300
}
);
svg50.Axes({
xPosPerc: 0, yPosPerc:0,
xPerc: 1, yPerc: 1,//full height and width
Data: [logData],
xaxisType: "log", yaxisType: "linear",
xTicks: 5,
xOrient: "bottom",
yTicks: 5,
yOrient: "left",
xLabel: "log scale",
yLabel: "linear scale"
});
var svg60 = new MakeSVGContainer(
{node: d3.select("#widgetTarget60"),
maxWid: 400,
maxHt: 400
}
);
svg60.Axes({
xPosPerc: 0, yPosPerc:0,
xPerc: 1, yPerc: 1,//full height and width
Data: [ordinalData],
xaxisType: "linear", yaxisType: "ordinal",
xTicks: 5,
xOrient: "bottom",
yOrient: "left",
xLabel: "linear scale",
yLabel: "ordinal scale"
});
</script>
</body>
</html>