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.PlotArea");
|
|
|
12 |
dojo.require("dojo.lang.common");
|
|
|
13 |
if (dojo.render.vml.capable) {
|
|
|
14 |
dojo.extend(dojo.charting.PlotArea, {resize:function () {
|
|
|
15 |
var a = this.getArea();
|
|
|
16 |
this.nodes.area.style.width = this.size.width + "px";
|
|
|
17 |
this.nodes.area.style.height = this.size.height + "px";
|
|
|
18 |
this.nodes.background.style.width = this.size.width + "px";
|
|
|
19 |
this.nodes.background.style.height = this.size.height + "px";
|
|
|
20 |
this.nodes.plots.width = this.size.width + "px";
|
|
|
21 |
this.nodes.plots.height = this.size.height + "px";
|
|
|
22 |
this.nodes.plots.style.clip = "rect(" + a.top + " " + a.right + " " + a.bottom + " " + a.left + ")";
|
|
|
23 |
if (this.nodes.axes) {
|
|
|
24 |
this.nodes.area.removeChild(this.nodes.axes);
|
|
|
25 |
}
|
|
|
26 |
var axes = this.nodes.axes = document.createElement("div");
|
|
|
27 |
axes.id = this.getId() + "-axes";
|
|
|
28 |
this.nodes.area.appendChild(axes);
|
|
|
29 |
var ax = this.getAxes();
|
|
|
30 |
for (var p in ax) {
|
|
|
31 |
var obj = ax[p];
|
|
|
32 |
axes.appendChild(obj.axis.initialize(this, obj.plot, obj.drawAgainst, obj.plane));
|
|
|
33 |
}
|
|
|
34 |
}, initializePlot:function (plot) {
|
|
|
35 |
plot.destroy();
|
|
|
36 |
plot.dataNode = document.createElement("div");
|
|
|
37 |
plot.dataNode.id = plot.getId();
|
|
|
38 |
return plot.dataNode;
|
|
|
39 |
}, initialize:function () {
|
|
|
40 |
this.destroy();
|
|
|
41 |
var main = this.nodes.main = document.createElement("div");
|
|
|
42 |
var area = this.nodes.area = document.createElement("div");
|
|
|
43 |
area.id = this.getId();
|
|
|
44 |
area.style.position = "absolute";
|
|
|
45 |
main.appendChild(area);
|
|
|
46 |
var bg = this.nodes.background = document.createElement("div");
|
|
|
47 |
bg.id = this.getId() + "-background";
|
|
|
48 |
bg.style.position = "absolute";
|
|
|
49 |
bg.style.top = "0px";
|
|
|
50 |
bg.style.left = "0px";
|
|
|
51 |
bg.style.backgroundColor = "#fff";
|
|
|
52 |
area.appendChild(bg);
|
|
|
53 |
var a = this.getArea();
|
|
|
54 |
var plots = this.nodes.plots = document.createElement("div");
|
|
|
55 |
plots.id = this.getId() + "-plots";
|
|
|
56 |
plots.style.position = "absolute";
|
|
|
57 |
plots.style.top = "0px";
|
|
|
58 |
plots.style.left = "0px";
|
|
|
59 |
area.appendChild(plots);
|
|
|
60 |
for (var i = 0; i < this.plots.length; i++) {
|
|
|
61 |
plots.appendChild(this.initializePlot(this.plots[i]));
|
|
|
62 |
}
|
|
|
63 |
this.resize();
|
|
|
64 |
return main;
|
|
|
65 |
}});
|
|
|
66 |
}
|
|
|
67 |
|