2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.charting.axis2d.common"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.charting.axis2d.common"] = true;
|
|
|
3 |
dojo.provide("dojox.charting.axis2d.common");
|
|
|
4 |
|
|
|
5 |
dojo.require("dojox.gfx");
|
|
|
6 |
|
|
|
7 |
(function(){
|
|
|
8 |
var g = dojox.gfx;
|
|
|
9 |
|
|
|
10 |
dojo.mixin(dojox.charting.axis2d.common, {
|
|
|
11 |
createText: {
|
|
|
12 |
gfx: function(chart, creator, x, y, align, text, font, fontColor){
|
|
|
13 |
return creator.createText({
|
|
|
14 |
x: x, y: y, text: text, align: align
|
|
|
15 |
}).setFont(font).setFill(fontColor);
|
|
|
16 |
},
|
|
|
17 |
html: function(chart, creator, x, y, align, text, font, fontColor){
|
|
|
18 |
var p = dojo.doc.createElement("div"), s = p.style;
|
|
|
19 |
s.marginLeft = "0px";
|
|
|
20 |
s.marginTop = "0px";
|
|
|
21 |
s.marginRight = "0px";
|
|
|
22 |
s.marginBottom = "0px";
|
|
|
23 |
s.paddingLeft = "0px";
|
|
|
24 |
s.paddingTop = "0px";
|
|
|
25 |
s.paddingRight = "0px";
|
|
|
26 |
s.paddingBottom = "0px";
|
|
|
27 |
s.borderLeftWidth = "0px";
|
|
|
28 |
s.borderTopWidth = "0px";
|
|
|
29 |
s.borderRightWidth = "0px";
|
|
|
30 |
s.borderBottomWidth = "0px";
|
|
|
31 |
s.position = "absolute";
|
|
|
32 |
s.font = font;
|
|
|
33 |
p.innerHTML = text;
|
|
|
34 |
s.color = fontColor;
|
|
|
35 |
chart.node.appendChild(p);
|
|
|
36 |
var parent = chart.getCoords(),
|
|
|
37 |
box = dojo.marginBox(p),
|
|
|
38 |
size = g.normalizedLength(g.splitFontString(font).size),
|
|
|
39 |
top = parent.y + Math.floor(y - size);
|
|
|
40 |
switch(align){
|
|
|
41 |
case "middle":
|
|
|
42 |
dojo.marginBox(p, {l: parent.x + Math.floor(x - box.w / 2), t: top});
|
|
|
43 |
break;
|
|
|
44 |
case "end":
|
|
|
45 |
dojo.marginBox(p, {l: parent.x + Math.floor(x - box.w), t: top});
|
|
|
46 |
break;
|
|
|
47 |
//case "start":
|
|
|
48 |
default:
|
|
|
49 |
dojo.marginBox(p, {l: parent.x + Math.floor(x), t: top});
|
|
|
50 |
break;
|
|
|
51 |
}
|
|
|
52 |
return p;
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
});
|
|
|
56 |
})();
|
|
|
57 |
|
|
|
58 |
}
|