Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
11
dojo.provide("dojo.charting.vml.Plotters");
12
dojo.require("dojo.lang.common");
13
if (dojo.render.vml.capable) {
14
	dojo.mixin(dojo.charting.Plotters, {_group:function (plotarea) {
15
		var group = document.createElement("div");
16
		group.style.position = "absolute";
17
		group.style.top = "0px";
18
		group.style.left = "0px";
19
		group.style.width = plotarea.size.width + "px";
20
		group.style.height = plotarea.size.height + "px";
21
		return group;
22
	}, Bar:function (plotarea, plot, kwArgs, applyTo) {
23
		var area = plotarea.getArea();
24
		var group = dojo.charting.Plotters._group(plotarea);
25
		var n = plot.series.length;
26
		var data = [];
27
		for (var i = 0; i < n; i++) {
28
			var tmp = plot.series[i].data.evaluate(kwArgs);
29
			data.push(tmp);
30
		}
31
		var space = 8;
32
		var nPoints = data[0].length;
33
		if (nPoints == 0) {
34
			return group;
35
		}
36
		var width = ((area.right - area.left) - (space * (nPoints - 1))) / nPoints;
37
		var barWidth = Math.round(width / n);
38
		var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
39
		for (var i = 0; i < nPoints; i++) {
40
			var xStart = area.left + (width * i) + (space * i);
41
			for (var j = 0; j < n; j++) {
42
				var value = data[j][i].y;
43
				var yA = yOrigin;
44
				var x = xStart + (barWidth * j);
45
				var y = plot.axisY.getCoord(value, plotarea, plot);
46
				var h = Math.abs(yA - y);
47
				if (value < plot.axisX.origin) {
48
					yA = y;
49
					y = yOrigin;
50
				}
51
				var bar = document.createElement("v:rect");
52
				bar.style.position = "absolute";
53
				bar.style.top = y + 1 + "px";
54
				bar.style.left = x + "px";
55
				bar.style.width = barWidth + "px";
56
				bar.style.height = h + "px";
57
				bar.setAttribute("fillColor", data[j][i].series.color);
58
				bar.setAttribute("stroked", "false");
59
				bar.style.antialias = "false";
60
				var fill = document.createElement("v:fill");
61
				fill.setAttribute("opacity", "0.6");
62
				bar.appendChild(fill);
63
				if (applyTo) {
64
					applyTo(bar, data[j][i].src);
65
				}
66
				group.appendChild(bar);
67
			}
68
		}
69
		return group;
70
	}, HorizontalBar:function (plotarea, plot, kwArgs, applyTo) {
71
		var area = plotarea.getArea();
72
		var group = dojo.charting.Plotters._group(plotarea);
73
		var n = plot.series.length;
74
		var data = [];
75
		for (var i = 0; i < n; i++) {
76
			var tmp = plot.series[i].data.evaluate(kwArgs);
77
			data.push(tmp);
78
		}
79
		var space = 6;
80
		var nPoints = data[0].length;
81
		if (nPoints == 0) {
82
			return group;
83
		}
84
		var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
85
		var barH = h / n;
86
		var xOrigin = plot.axisX.getCoord(0, plotarea, plot);
87
		for (var i = 0; i < nPoints; i++) {
88
			var yStart = area.top + (h * i) + (space * i);
89
			for (var j = 0; j < n; j++) {
90
				var value = data[j][i].y;
91
				var y = yStart + (barH * j);
92
				var xA = xOrigin;
93
				var x = plot.axisX.getCoord(value, plotarea, plot);
94
				var w = Math.abs(x - xA);
95
				if (value > 0) {
96
					x = xOrigin;
97
				}
98
				var bar = document.createElement("v:rect");
99
				bar.style.position = "absolute";
100
				bar.style.top = y + 1 + "px";
101
				bar.style.left = xA + "px";
102
				bar.style.width = w + "px";
103
				bar.style.height = barH + "px";
104
				bar.setAttribute("fillColor", data[j][i].series.color);
105
				bar.setAttribute("stroked", "false");
106
				bar.style.antialias = "false";
107
				var fill = document.createElement("v:fill");
108
				fill.setAttribute("opacity", "0.6");
109
				bar.appendChild(fill);
110
				if (applyTo) {
111
					applyTo(bar, data[j][i].src);
112
				}
113
				group.appendChild(bar);
114
			}
115
		}
116
		var space = 4;
117
		var n = plot.series.length;
118
		var h = ((area.bottom - area.top) - (space * (n - 1))) / n;
119
		var xOrigin = plot.axisX.getCoord(0, plotarea, plot);
120
		for (var i = 0; i < n; i++) {
121
			var series = plot.series[i];
122
			var data = series.data.evaluate(kwArgs);
123
			var y = area.top + (h * i) + (space * i);
124
			var value = data[data.length - 1].y;
125
			var xA = xOrigin;
126
			var x = plot.axisX.getCoord(value, plotarea, plot);
127
			var w = Math.abs(xA - x);
128
			if (value > 0) {
129
				xA = x;
130
				x = xOrigin;
131
			}
132
		}
133
		return group;
134
	}, Gantt:function (plotarea, plot, kwArgs, applyTo) {
135
		var area = plotarea.getArea();
136
		var group = dojo.charting.Plotters._group(plotarea);
137
		var n = plot.series.length;
138
		var data = [];
139
		for (var i = 0; i < n; i++) {
140
			var tmp = plot.series[i].data.evaluate(kwArgs);
141
			data.push(tmp);
142
		}
143
		var space = 2;
144
		var nPoints = data[0].length;
145
		if (nPoints == 0) {
146
			return group;
147
		}
148
		var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
149
		var barH = h / n;
150
		for (var i = 0; i < nPoints; i++) {
151
			var yStart = area.top + (h * i) + (space * i);
152
			for (var j = 0; j < n; j++) {
153
				var high = data[j][i].high;
154
				var low = data[j][i].low;
155
				if (low > high) {
156
					var t = high;
157
					high = low;
158
					low = t;
159
				}
160
				var x = plot.axisX.getCoord(low, plotarea, plot);
161
				var w = plot.axisX.getCoord(high, plotarea, plot) - x;
162
				var y = yStart + (barH * j);
163
				var bar = document.createElement("v:rect");
164
				bar.style.position = "absolute";
165
				bar.style.top = y + 1 + "px";
166
				bar.style.left = x + "px";
167
				bar.style.width = w + "px";
168
				bar.style.height = barH + "px";
169
				bar.setAttribute("fillColor", data[j][i].series.color);
170
				bar.setAttribute("stroked", "false");
171
				bar.style.antialias = "false";
172
				var fill = document.createElement("v:fill");
173
				fill.setAttribute("opacity", "0.6");
174
				bar.appendChild(fill);
175
				if (applyTo) {
176
					applyTo(bar, data[j][i].src);
177
				}
178
				group.appendChild(bar);
179
			}
180
		}
181
		return group;
182
	}, StackedArea:function (plotarea, plot, kwArgs, applyTo) {
183
		var area = plotarea.getArea();
184
		var group = dojo.charting.Plotters._group(plotarea);
185
		var n = plot.series.length;
186
		var data = [];
187
		var totals = [];
188
		for (var i = 0; i < n; i++) {
189
			var tmp = plot.series[i].data.evaluate(kwArgs);
190
			for (var j = 0; j < tmp.length; j++) {
191
				if (i == 0) {
192
					totals.push(tmp[j].y);
193
				} else {
194
					totals[j] += tmp[j].y;
195
				}
196
				tmp[j].y = totals[j];
197
			}
198
			data.push(tmp);
199
		}
200
		for (var i = n - 1; i >= 0; i--) {
201
			var path = document.createElement("v:shape");
202
			path.setAttribute("strokeweight", "1px");
203
			path.setAttribute("strokecolor", data[i][0].series.color);
204
			path.setAttribute("fillcolor", data[i][0].series.color);
205
			path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
206
			path.style.position = "absolute";
207
			path.style.top = "0px";
208
			path.style.left = "0px";
209
			path.style.width = area.right - area.left + "px";
210
			path.style.height = area.bottom - area.top + "px";
211
			var stroke = document.createElement("v:stroke");
212
			stroke.setAttribute("opacity", "0.8");
213
			path.appendChild(stroke);
214
			var fill = document.createElement("v:fill");
215
			fill.setAttribute("opacity", "0.4");
216
			path.appendChild(fill);
217
			var cmd = [];
218
			var r = 3;
219
			for (var j = 0; j < data[i].length; j++) {
220
				var values = data[i];
221
				var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
222
				var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
223
				if (j == 0) {
224
					cmd.push("m");
225
					cmd.push(x + "," + y);
226
				} else {
227
					cmd.push("l");
228
					cmd.push(x + "," + y);
229
				}
230
				var c = document.createElement("v:oval");
231
				c.setAttribute("strokeweight", "1px");
232
				c.setAttribute("strokecolor", values[j].series.color);
233
				c.setAttribute("fillcolor", values[j].series.color);
234
				var str = document.createElement("v:stroke");
235
				str.setAttribute("opacity", "0.8");
236
				c.appendChild(str);
237
				str = document.createElement("v:fill");
238
				str.setAttribute("opacity", "0.6");
239
				c.appendChild(str);
240
				var s = c.style;
241
				s.position = "absolute";
242
				s.top = (y - r) + "px";
243
				s.left = (x - r) + "px";
244
				s.width = (r * 2) + "px";
245
				s.height = (r * 2) + "px";
246
				group.appendChild(c);
247
				if (applyTo) {
248
					applyTo(c, data[j].src);
249
				}
250
			}
251
			if (i == 0) {
252
				cmd.push("l");
253
				cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
254
				cmd.push("l");
255
				cmd.push(Math.round(plot.axisX.getCoord(data[0][0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
256
			} else {
257
				var values = data[i - 1];
258
				cmd.push("l");
259
				cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
260
				for (var j = values.length - 2; j >= 0; j--) {
261
					var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
262
					var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
263
					cmd.push("l");
264
					cmd.push(x + "," + y);
265
				}
266
			}
267
			path.setAttribute("path", cmd.join(" ") + " x e");
268
			group.appendChild(path);
269
		}
270
		return group;
271
	}, StackedCurvedArea:function (plotarea, plot, kwArgs, applyTo) {
272
		var tension = 3;
273
		var area = plotarea.getArea();
274
		var group = dojo.charting.Plotters._group(plotarea);
275
		var n = plot.series.length;
276
		var data = [];
277
		var totals = [];
278
		for (var i = 0; i < n; i++) {
279
			var tmp = plot.series[i].data.evaluate(kwArgs);
280
			for (var j = 0; j < tmp.length; j++) {
281
				if (i == 0) {
282
					totals.push(tmp[j].y);
283
				} else {
284
					totals[j] += tmp[j].y;
285
				}
286
				tmp[j].y = totals[j];
287
			}
288
			data.push(tmp);
289
		}
290
		for (var i = n - 1; i >= 0; i--) {
291
			var path = document.createElement("v:shape");
292
			path.setAttribute("strokeweight", "1px");
293
			path.setAttribute("strokecolor", data[i][0].series.color);
294
			path.setAttribute("fillcolor", data[i][0].series.color);
295
			path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
296
			path.style.position = "absolute";
297
			path.style.top = "0px";
298
			path.style.left = "0px";
299
			path.style.width = area.right - area.left + "px";
300
			path.style.height = area.bottom - area.top + "px";
301
			var stroke = document.createElement("v:stroke");
302
			stroke.setAttribute("opacity", "0.8");
303
			path.appendChild(stroke);
304
			var fill = document.createElement("v:fill");
305
			fill.setAttribute("opacity", "0.4");
306
			path.appendChild(fill);
307
			var cmd = [];
308
			var r = 3;
309
			for (var j = 0; j < data[i].length; j++) {
310
				var values = data[i];
311
				var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
312
				var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
313
				if (j == 0) {
314
					cmd.push("m");
315
					cmd.push(x + "," + y);
316
				} else {
317
					var lastx = Math.round(plot.axisX.getCoord(values[j - 1].x, plotarea, plot));
318
					var lasty = Math.round(plot.axisY.getCoord(values[j - 1].y, plotarea, plot));
319
					var dx = x - lastx;
320
					var dy = y - lasty;
321
					cmd.push("c");
322
					var cx = Math.round((x - (tension - 1) * (dx / tension)));
323
					cmd.push(cx + "," + lasty);
324
					cx = Math.round((x - (dx / tension)));
325
					cmd.push(cx + "," + y);
326
					cmd.push(x + "," + y);
327
				}
328
				var c = document.createElement("v:oval");
329
				c.setAttribute("strokeweight", "1px");
330
				c.setAttribute("strokecolor", values[j].series.color);
331
				c.setAttribute("fillcolor", values[j].series.color);
332
				var str = document.createElement("v:stroke");
333
				str.setAttribute("opacity", "0.8");
334
				c.appendChild(str);
335
				str = document.createElement("v:fill");
336
				str.setAttribute("opacity", "0.6");
337
				c.appendChild(str);
338
				var s = c.style;
339
				s.position = "absolute";
340
				s.top = (y - r) + "px";
341
				s.left = (x - r) + "px";
342
				s.width = (r * 2) + "px";
343
				s.height = (r * 2) + "px";
344
				group.appendChild(c);
345
				if (applyTo) {
346
					applyTo(c, data[j].src);
347
				}
348
			}
349
			if (i == 0) {
350
				cmd.push("l");
351
				cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
352
				cmd.push("l");
353
				cmd.push(Math.round(plot.axisX.getCoord(data[0][0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
354
			} else {
355
				var values = data[i - 1];
356
				cmd.push("l");
357
				cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
358
				for (var j = values.length - 2; j >= 0; j--) {
359
					var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
360
					var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
361
					var lastx = Math.round(plot.axisX.getCoord(values[j + 1].x, plotarea, plot));
362
					var lasty = Math.round(plot.axisY.getCoord(values[j + 1].y, plotarea, plot));
363
					var dx = x - lastx;
364
					var dy = y - lasty;
365
					cmd.push("c");
366
					var cx = Math.round((x - (tension - 1) * (dx / tension)));
367
					cmd.push(cx + "," + lasty);
368
					cx = Math.round((x - (dx / tension)));
369
					cmd.push(cx + "," + y);
370
					cmd.push(x + "," + y);
371
				}
372
			}
373
			path.setAttribute("path", cmd.join(" ") + " x e");
374
			group.appendChild(path);
375
		}
376
		return group;
377
	}, DataBar:function (data, plotarea, plot, applyTo) {
378
		var area = plotarea.getArea();
379
		var group = dojo.charting.Plotters._group(plotarea);
380
		var n = data.length;
381
		var w = (area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower);
382
		var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
383
		for (var i = 0; i < n; i++) {
384
			var value = data[i].y;
385
			var yA = yOrigin;
386
			var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2) + 1;
387
			var y = plot.axisY.getCoord(value, plotarea, plot);
388
			var h = Math.abs(yA - y);
389
			if (value < plot.axisX.origin) {
390
				yA = y;
391
				y = yOrigin;
392
			}
393
			var bar = document.createElement("v:rect");
394
			bar.style.position = "absolute";
395
			bar.style.top = y + 1 + "px";
396
			bar.style.left = x + "px";
397
			bar.style.width = w + "px";
398
			bar.style.height = h + "px";
399
			bar.setAttribute("fillColor", data[i].series.color);
400
			bar.setAttribute("stroked", "false");
401
			bar.style.antialias = "false";
402
			var fill = document.createElement("v:fill");
403
			fill.setAttribute("opacity", "0.6");
404
			bar.appendChild(fill);
405
			if (applyTo) {
406
				applyTo(bar, data[i].src);
407
			}
408
			group.appendChild(bar);
409
		}
410
		return group;
411
	}, Line:function (data, plotarea, plot, applyTo) {
412
		var area = plotarea.getArea();
413
		var group = dojo.charting.Plotters._group(plotarea);
414
		if (data.length == 0) {
415
			return group;
416
		}
417
		var path = document.createElement("v:shape");
418
		path.setAttribute("strokeweight", "2px");
419
		path.setAttribute("strokecolor", data[0].series.color);
420
		path.setAttribute("fillcolor", "none");
421
		path.setAttribute("filled", "false");
422
		path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
423
		path.style.position = "absolute";
424
		path.style.top = "0px";
425
		path.style.left = "0px";
426
		path.style.width = area.right - area.left + "px";
427
		path.style.height = area.bottom - area.top + "px";
428
		var stroke = document.createElement("v:stroke");
429
		stroke.setAttribute("opacity", "0.8");
430
		path.appendChild(stroke);
431
		var cmd = [];
432
		var r = 3;
433
		for (var i = 0; i < data.length; i++) {
434
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
435
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
436
			if (i == 0) {
437
				cmd.push("m");
438
				cmd.push(x + "," + y);
439
			} else {
440
				cmd.push("l");
441
				cmd.push(x + "," + y);
442
			}
443
			var c = document.createElement("v:oval");
444
			c.setAttribute("strokeweight", "1px");
445
			c.setAttribute("strokecolor", data[i].series.color);
446
			c.setAttribute("fillcolor", data[i].series.color);
447
			var str = document.createElement("v:stroke");
448
			str.setAttribute("opacity", "0.8");
449
			c.appendChild(str);
450
			str = document.createElement("v:fill");
451
			str.setAttribute("opacity", "0.6");
452
			c.appendChild(str);
453
			var s = c.style;
454
			s.position = "absolute";
455
			s.top = (y - r) + "px";
456
			s.left = (x - r) + "px";
457
			s.width = (r * 2) + "px";
458
			s.height = (r * 2) + "px";
459
			group.appendChild(c);
460
			if (applyTo) {
461
				applyTo(c, data[i].src);
462
			}
463
		}
464
		path.setAttribute("path", cmd.join(" ") + " e");
465
		group.appendChild(path);
466
		return group;
467
	}, CurvedLine:function (data, plotarea, plot, applyTo) {
468
		var tension = 3;
469
		var area = plotarea.getArea();
470
		var group = dojo.charting.Plotters._group(plotarea);
471
		if (data.length == 0) {
472
			return group;
473
		}
474
		var path = document.createElement("v:shape");
475
		path.setAttribute("strokeweight", "2px");
476
		path.setAttribute("strokecolor", data[0].series.color);
477
		path.setAttribute("fillcolor", "none");
478
		path.setAttribute("filled", "false");
479
		path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
480
		path.style.position = "absolute";
481
		path.style.top = "0px";
482
		path.style.left = "0px";
483
		path.style.width = area.right - area.left + "px";
484
		path.style.height = area.bottom - area.top + "px";
485
		var stroke = document.createElement("v:stroke");
486
		stroke.setAttribute("opacity", "0.8");
487
		path.appendChild(stroke);
488
		var cmd = [];
489
		var r = 3;
490
		for (var i = 0; i < data.length; i++) {
491
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
492
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
493
			if (i == 0) {
494
				cmd.push("m");
495
				cmd.push(x + "," + y);
496
			} else {
497
				var lastx = Math.round(plot.axisX.getCoord(data[i - 1].x, plotarea, plot));
498
				var lasty = Math.round(plot.axisY.getCoord(data[i - 1].y, plotarea, plot));
499
				var dx = x - lastx;
500
				var dy = y - lasty;
501
				cmd.push("c");
502
				var cx = Math.round((x - (tension - 1) * (dx / tension)));
503
				cmd.push(cx + "," + lasty);
504
				cx = Math.round((x - (dx / tension)));
505
				cmd.push(cx + "," + y);
506
				cmd.push(x + "," + y);
507
			}
508
			var c = document.createElement("v:oval");
509
			c.setAttribute("strokeweight", "1px");
510
			c.setAttribute("strokecolor", data[i].series.color);
511
			c.setAttribute("fillcolor", data[i].series.color);
512
			var str = document.createElement("v:stroke");
513
			str.setAttribute("opacity", "0.8");
514
			c.appendChild(str);
515
			str = document.createElement("v:fill");
516
			str.setAttribute("opacity", "0.6");
517
			c.appendChild(str);
518
			var s = c.style;
519
			s.position = "absolute";
520
			s.top = (y - r) + "px";
521
			s.left = (x - r) + "px";
522
			s.width = (r * 2) + "px";
523
			s.height = (r * 2) + "px";
524
			group.appendChild(c);
525
			if (applyTo) {
526
				applyTo(c, data[i].src);
527
			}
528
		}
529
		path.setAttribute("path", cmd.join(" ") + " e");
530
		group.appendChild(path);
531
		return group;
532
	}, Area:function (data, plotarea, plot, applyTo) {
533
		var area = plotarea.getArea();
534
		var group = dojo.charting.Plotters._group(plotarea);
535
		if (data.length == 0) {
536
			return group;
537
		}
538
		var path = document.createElement("v:shape");
539
		path.setAttribute("strokeweight", "1px");
540
		path.setAttribute("strokecolor", data[0].series.color);
541
		path.setAttribute("fillcolor", data[0].series.color);
542
		path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
543
		path.style.position = "absolute";
544
		path.style.top = "0px";
545
		path.style.left = "0px";
546
		path.style.width = area.right - area.left + "px";
547
		path.style.height = area.bottom - area.top + "px";
548
		var stroke = document.createElement("v:stroke");
549
		stroke.setAttribute("opacity", "0.8");
550
		path.appendChild(stroke);
551
		var fill = document.createElement("v:fill");
552
		fill.setAttribute("opacity", "0.4");
553
		path.appendChild(fill);
554
		var cmd = [];
555
		var r = 3;
556
		for (var i = 0; i < data.length; i++) {
557
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
558
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
559
			if (i == 0) {
560
				cmd.push("m");
561
				cmd.push(x + "," + y);
562
			} else {
563
				cmd.push("l");
564
				cmd.push(x + "," + y);
565
			}
566
			var c = document.createElement("v:oval");
567
			c.setAttribute("strokeweight", "1px");
568
			c.setAttribute("strokecolor", data[i].series.color);
569
			c.setAttribute("fillcolor", data[i].series.color);
570
			var str = document.createElement("v:stroke");
571
			str.setAttribute("opacity", "0.8");
572
			c.appendChild(str);
573
			str = document.createElement("v:fill");
574
			str.setAttribute("opacity", "0.6");
575
			c.appendChild(str);
576
			var s = c.style;
577
			s.position = "absolute";
578
			s.top = (y - r) + "px";
579
			s.left = (x - r) + "px";
580
			s.width = (r * 2) + "px";
581
			s.height = (r * 2) + "px";
582
			group.appendChild(c);
583
			if (applyTo) {
584
				applyTo(c, data[i].src);
585
			}
586
		}
587
		cmd.push("l");
588
		cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
589
		cmd.push("l");
590
		cmd.push(Math.round(plot.axisX.getCoord(data[0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
591
		path.setAttribute("path", cmd.join(" ") + " x e");
592
		group.appendChild(path);
593
		return group;
594
	}, CurvedArea:function (data, plotarea, plot, applyTo) {
595
		var tension = 3;
596
		var area = plotarea.getArea();
597
		var group = dojo.charting.Plotters._group(plotarea);
598
		if (data.length == 0) {
599
			return group;
600
		}
601
		var path = document.createElement("v:shape");
602
		path.setAttribute("strokeweight", "1px");
603
		path.setAttribute("strokecolor", data[0].series.color);
604
		path.setAttribute("fillcolor", data[0].series.color);
605
		path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
606
		path.style.position = "absolute";
607
		path.style.top = "0px";
608
		path.style.left = "0px";
609
		path.style.width = area.right - area.left + "px";
610
		path.style.height = area.bottom - area.top + "px";
611
		var stroke = document.createElement("v:stroke");
612
		stroke.setAttribute("opacity", "0.8");
613
		path.appendChild(stroke);
614
		var fill = document.createElement("v:fill");
615
		fill.setAttribute("opacity", "0.4");
616
		path.appendChild(fill);
617
		var cmd = [];
618
		var r = 3;
619
		for (var i = 0; i < data.length; i++) {
620
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
621
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
622
			if (i == 0) {
623
				cmd.push("m");
624
				cmd.push(x + "," + y);
625
			} else {
626
				var lastx = Math.round(plot.axisX.getCoord(data[i - 1].x, plotarea, plot));
627
				var lasty = Math.round(plot.axisY.getCoord(data[i - 1].y, plotarea, plot));
628
				var dx = x - lastx;
629
				var dy = y - lasty;
630
				cmd.push("c");
631
				var cx = Math.round((x - (tension - 1) * (dx / tension)));
632
				cmd.push(cx + "," + lasty);
633
				cx = Math.round((x - (dx / tension)));
634
				cmd.push(cx + "," + y);
635
				cmd.push(x + "," + y);
636
			}
637
			var c = document.createElement("v:oval");
638
			c.setAttribute("strokeweight", "1px");
639
			c.setAttribute("strokecolor", data[i].series.color);
640
			c.setAttribute("fillcolor", data[i].series.color);
641
			var str = document.createElement("v:stroke");
642
			str.setAttribute("opacity", "0.8");
643
			c.appendChild(str);
644
			str = document.createElement("v:fill");
645
			str.setAttribute("opacity", "0.6");
646
			c.appendChild(str);
647
			var s = c.style;
648
			s.position = "absolute";
649
			s.top = (y - r) + "px";
650
			s.left = (x - r) + "px";
651
			s.width = (r * 2) + "px";
652
			s.height = (r * 2) + "px";
653
			group.appendChild(c);
654
			if (applyTo) {
655
				applyTo(c, data[i].src);
656
			}
657
		}
658
		cmd.push("l");
659
		cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
660
		cmd.push("l");
661
		cmd.push(Math.round(plot.axisX.getCoord(data[0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
662
		path.setAttribute("path", cmd.join(" ") + " x e");
663
		group.appendChild(path);
664
		return group;
665
	}, HighLow:function (data, plotarea, plot, applyTo) {
666
		var area = plotarea.getArea();
667
		var group = dojo.charting.Plotters._group(plotarea);
668
		var n = data.length;
669
		var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
670
		var w = part * 2;
671
		for (var i = 0; i < n; i++) {
672
			var high = data[i].high;
673
			var low = data[i].low;
674
			if (low > high) {
675
				var t = low;
676
				low = high;
677
				high = t;
678
			}
679
			var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
680
			var y = plot.axisY.getCoord(high, plotarea, plot);
681
			var h = plot.axisY.getCoord(low, plotarea, plot) - y;
682
			var bar = document.createElement("v:rect");
683
			bar.style.position = "absolute";
684
			bar.style.top = y + 1 + "px";
685
			bar.style.left = x + "px";
686
			bar.style.width = w + "px";
687
			bar.style.height = h + "px";
688
			bar.setAttribute("fillColor", data[i].series.color);
689
			bar.setAttribute("stroked", "false");
690
			bar.style.antialias = "false";
691
			var fill = document.createElement("v:fill");
692
			fill.setAttribute("opacity", "0.6");
693
			bar.appendChild(fill);
694
			if (applyTo) {
695
				applyTo(bar, data[i].src);
696
			}
697
			group.appendChild(bar);
698
		}
699
		return group;
700
	}, HighLowClose:function (data, plotarea, plot, applyTo) {
701
		var area = plotarea.getArea();
702
		var group = dojo.charting.Plotters._group(plotarea);
703
		var n = data.length;
704
		var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
705
		var w = part * 2;
706
		for (var i = 0; i < n; i++) {
707
			var high = data[i].high;
708
			var low = data[i].low;
709
			if (low > high) {
710
				var t = low;
711
				low = high;
712
				high = t;
713
			}
714
			var c = data[i].close;
715
			var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
716
			var y = plot.axisY.getCoord(high, plotarea, plot);
717
			var h = plot.axisY.getCoord(low, plotarea, plot) - y;
718
			var close = plot.axisY.getCoord(c, plotarea, plot);
719
			var g = document.createElement("div");
720
			var bar = document.createElement("v:rect");
721
			bar.style.position = "absolute";
722
			bar.style.top = y + 1 + "px";
723
			bar.style.left = x + "px";
724
			bar.style.width = w + "px";
725
			bar.style.height = h + "px";
726
			bar.setAttribute("fillColor", data[i].series.color);
727
			bar.setAttribute("stroked", "false");
728
			bar.style.antialias = "false";
729
			var fill = document.createElement("v:fill");
730
			fill.setAttribute("opacity", "0.6");
731
			bar.appendChild(fill);
732
			g.appendChild(bar);
733
			var line = document.createElement("v:line");
734
			line.setAttribute("strokecolor", data[i].series.color);
735
			line.setAttribute("strokeweight", "1px");
736
			line.setAttribute("from", x + "px," + close + "px");
737
			line.setAttribute("to", (x + w + (part * 2) - 2) + "px," + close + "px");
738
			var s = line.style;
739
			s.position = "absolute";
740
			s.top = "0px";
741
			s.left = "0px";
742
			s.antialias = "false";
743
			var str = document.createElement("v:stroke");
744
			str.setAttribute("opacity", "0.6");
745
			line.appendChild(str);
746
			g.appendChild(line);
747
			if (applyTo) {
748
				applyTo(g, data[i].src);
749
			}
750
			group.appendChild(g);
751
		}
752
		return group;
753
	}, HighLowOpenClose:function (data, plotarea, plot, applyTo) {
754
		var area = plotarea.getArea();
755
		var group = dojo.charting.Plotters._group(plotarea);
756
		var n = data.length;
757
		var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
758
		var w = part * 2;
759
		for (var i = 0; i < n; i++) {
760
			var high = data[i].high;
761
			var low = data[i].low;
762
			if (low > high) {
763
				var t = low;
764
				low = high;
765
				high = t;
766
			}
767
			var o = data[i].open;
768
			var c = data[i].close;
769
			var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
770
			var y = plot.axisY.getCoord(high, plotarea, plot);
771
			var h = plot.axisY.getCoord(low, plotarea, plot) - y;
772
			var open = plot.axisY.getCoord(o, plotarea, plot);
773
			var close = plot.axisY.getCoord(c, plotarea, plot);
774
			var g = document.createElement("div");
775
			var bar = document.createElement("v:rect");
776
			bar.style.position = "absolute";
777
			bar.style.top = y + 1 + "px";
778
			bar.style.left = x + "px";
779
			bar.style.width = w + "px";
780
			bar.style.height = h + "px";
781
			bar.setAttribute("fillColor", data[i].series.color);
782
			bar.setAttribute("stroked", "false");
783
			bar.style.antialias = "false";
784
			var fill = document.createElement("v:fill");
785
			fill.setAttribute("opacity", "0.6");
786
			bar.appendChild(fill);
787
			g.appendChild(bar);
788
			var line = document.createElement("v:line");
789
			line.setAttribute("strokecolor", data[i].series.color);
790
			line.setAttribute("strokeweight", "1px");
791
			line.setAttribute("from", (x - (part * 2)) + "px," + open + "px");
792
			line.setAttribute("to", (x + w - 2) + "px," + open + "px");
793
			var s = line.style;
794
			s.position = "absolute";
795
			s.top = "0px";
796
			s.left = "0px";
797
			s.antialias = "false";
798
			var str = document.createElement("v:stroke");
799
			str.setAttribute("opacity", "0.6");
800
			line.appendChild(str);
801
			g.appendChild(line);
802
			var line = document.createElement("v:line");
803
			line.setAttribute("strokecolor", data[i].series.color);
804
			line.setAttribute("strokeweight", "1px");
805
			line.setAttribute("from", x + "px," + close + "px");
806
			line.setAttribute("to", (x + w + (part * 2) - 2) + "px," + close + "px");
807
			var s = line.style;
808
			s.position = "absolute";
809
			s.top = "0px";
810
			s.left = "0px";
811
			s.antialias = "false";
812
			var str = document.createElement("v:stroke");
813
			str.setAttribute("opacity", "0.6");
814
			line.appendChild(str);
815
			g.appendChild(line);
816
			if (applyTo) {
817
				applyTo(g, data[i].src);
818
			}
819
			group.appendChild(g);
820
		}
821
		return group;
822
	}, Scatter:function (data, plotarea, plot, applyTo) {
823
		var r = 6;
824
		var mod = r / 2;
825
		var area = plotarea.getArea();
826
		var group = dojo.charting.Plotters._group(plotarea);
827
		for (var i = 0; i < data.length; i++) {
828
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
829
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
830
			var point = document.createElement("v:rect");
831
			point.setAttribute("strokecolor", data[i].series.color);
832
			point.setAttribute("fillcolor", data[i].series.color);
833
			var fill = document.createElement("v:fill");
834
			fill.setAttribute("opacity", "0.6");
835
			point.appendChild(fill);
836
			var s = point.style;
837
			s.position = "absolute";
838
			s.rotation = "45";
839
			s.top = (y - mod) + "px";
840
			s.left = (x - mod) + "px";
841
			s.width = r + "px";
842
			s.height = r + "px";
843
			group.appendChild(point);
844
			if (applyTo) {
845
				applyTo(point, data[i].src);
846
			}
847
		}
848
		return group;
849
	}, Bubble:function (data, plotarea, plot, applyTo) {
850
		var sizeFactor = 1;
851
		var area = plotarea.getArea();
852
		var group = dojo.charting.Plotters._group(plotarea);
853
		for (var i = 0; i < data.length; i++) {
854
			var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
855
			var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
856
			if (i == 0) {
857
				var raw = data[i].size;
858
				var dy = plot.axisY.getCoord(data[i].y + raw, plotarea, plot) - y;
859
				sizeFactor = dy / raw;
860
			}
861
			if (sizeFactor < 1) {
862
				sizeFactor = 1;
863
			}
864
			var r = (data[i].size / 2) * sizeFactor;
865
			var point = document.createElement("v:oval");
866
			point.setAttribute("strokecolor", data[i].series.color);
867
			point.setAttribute("fillcolor", data[i].series.color);
868
			var fill = document.createElement("v:fill");
869
			fill.setAttribute("opacity", "0.6");
870
			point.appendChild(fill);
871
			var s = point.style;
872
			s.position = "absolute";
873
			s.rotation = "45";
874
			s.top = (y - r) + "px";
875
			s.left = (x - r) + "px";
876
			s.width = (r * 2) + "px";
877
			s.height = (r * 2) + "px";
878
			group.appendChild(point);
879
			if (applyTo) {
880
				applyTo(point, data[i].src);
881
			}
882
		}
883
		return group;
884
	}});
885
	dojo.charting.Plotters["Default"] = dojo.charting.Plotters.Line;
886
}
887