Subversion Repositories Applications.papyrus

Rev

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