* @param orentation //0=top 1=right 2=bottom 3=left
*
*/
- axis: function (x, y, length, from, to, steps, orientation, labels, type, dashsize, paper) {
+ axis: function (x, y, length, from, to, steps, orientation, labels, type, dashsize, paper)
+ {
+ var opts = {};
+ Roo.log(x);
+
+ if (Raphael.is(x,"object")) {
+ opts = x;
+ x = opts.x;
+ y = opts.y;
+ length = opts.length;
+ from = opts.from;
+ to = opts.to;
+ steps = opts.steps;
+ orientation = opts.orientation;
+ labels = opts.labels,
+ type = opts.type,
+ dashsize = opts.dashsize;
+ paper = opts.paper;
+ } else {
+ paper = arguments[arguments.length-1] //paper is always last argument
+ }
+ opts.loffset = (opts.loffset || 0);
+ opts.roffset = (opts.roffset || 0);
+
dashsize = dashsize == null ? 2 : dashsize;
type = type || "t";
steps = steps || 10;
- paper = arguments[arguments.length-1] //paper is always last argument
+
- var path = type == "|" || type == " " ? ["M", x + .5, y, "l", 0, .001] : orientation == 1 || orientation == 3 ? ["M", x + .5, y, "l", 0, -length] : ["M", x, y + .5, "l", length, 0],
+ var path = type == "|" || type == " " ? ["M", x + .5, y, "l", 0, .001] : // this is the main bar line.
+ orientation == 1 || orientation == 3 ?
+ ["M", x + .5, y, "l", 0, -length] :
+ ["M", x, y + .5, "l", length, 0],
ends = this.snapEnds(from, to, steps),
f = ends.from,
t = ends.to,
rnd = (i > 0) * i;
addon = (orientation ? -1 : 1) * (dashsize + 9 + !orientation);
- var X = x,
- dx = length / steps,
+ var X = x + opts.loffset,
+ dx = (length - (opts.loffset + opts.roffset)) / steps,
txt = 0,
prev = 0;
-
+
+ if(dx < 1){
+ dx = 1;
+ }
+
while (X <= x + length) {
+ Roo.log('label ' + j + ":" + labels[j]);
+
+ if (typeof(labels[j]) == 'undefined') {
+ label += d;
+ X += dx;
+ continue;
+ }
+ // add the line
type != "-" && type != " " && (path = path.concat(["M", X + .5, y - (type == "+" ? dashsize : !!orientation * dashsize * 2), "l", 0, dashsize * 2 + 1]));
+ // add the text...
text.push(txt = paper.text(X, y + addon, (labels && labels[j++]) || (Math.round(label) == label ? label : +label.toFixed(rnd))).attr(txtattr));
var bb = txt.getBBox();
X += dx;
}
- if (Math.round(X - dx - x - length)) {
+ if (Math.round(X - dx - x - length) && typeof(labels[j]) != 'undefined') {
+
type != "-" && type != " " && (path = path.concat(["M", x + length + .5, y - (type == "+" ? dashsize : !!orientation * dashsize * 2), "l", 0, dashsize * 2 + 1]));
text.push(paper.text(x + length, y + addon, (labels && labels[j]) || (Math.round(label) == label ? label : +label.toFixed(rnd))).attr(txtattr));
}