Skip to content

Commit

Permalink
See DmitryBaranovskiy#137: More adjustments to the grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
bigspotteddog committed Jul 5, 2012
1 parent 6778700 commit 7630040
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions g.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@

if (opts.axis) {
var ax = (opts.axis + "").split(/[,\s]+/);
+ax[0] && axis.push(chartinst.axis(x + gutter, y + gutter, width - 2 * gutter, minx, maxx, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 2, paper));
+ax[1] && axis.push(chartinst.axis(x + width - gutter, y + height - gutter, height - 2 * gutter, miny, maxy, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 3, paper));
+ax[2] && axis.push(chartinst.axis(x + gutter, y + height - gutter, width - 2 * gutter, minx, maxx, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 0, paper));
+ax[3] && axis.push(chartinst.axis(x + gutter, y + height - gutter, height - 2 * gutter, miny, maxy, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 1, paper));
(+ax[0] || +ax[2]) && chartinst.grid(x + gutter, gutter + 10, width - 2 * gutter, height - 2 * gutter, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 0, paper);
(+ax[1] || +ax[3]) && chartinst.grid(x + gutter, y + height - gutter, width - 2 * gutter, height - 2 * gutter, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 1, paper);
}

if (opts.axis) {
var ax = (opts.axis + "").split(/[,\s]+/);
(+ax[0] || +ax[2]) && axis.push(chartinst.grid(x + gutter, 2 * gutter, width - 2 * gutter, height, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 0, paper));
(+ax[1] || +ax[3]) && axis.push(chartinst.grid(x + gutter, y + height - gutter, width - 2 * gutter, height - 2 * gutter, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 1, paper));
+ax[0] && axis.push(chartinst.axis(x + gutter, y + gutter, width - 2 * gutter, minx, maxx, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 2, paper));
+ax[1] && axis.push(chartinst.axis(x + width - gutter, y + height - gutter, height - 2 * gutter, miny, maxy, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 3, paper));
+ax[2] && axis.push(chartinst.axis(x + gutter, y + height - gutter, width - 2 * gutter, minx, maxx, opts.axisxstep || Math.floor((width - 2 * gutter) / 20), 0, paper));
+ax[3] && axis.push(chartinst.axis(x + gutter, y + height - gutter, height - 2 * gutter, miny, maxy, opts.axisystep || Math.floor((height - 2 * gutter) / 20), 1, paper));
}

var lines = paper.set(),
Expand Down Expand Up @@ -319,6 +319,7 @@
return this;
};

chart.opts = opts;
return chart;
};

Expand Down
2 changes: 2 additions & 0 deletions g.raphael.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ Raphael.g = {
grid = grid.concat(["M", X, y, "l", 0, height]);
X += dx;
}
grid = grid.concat(["M", X, y, "l", 0, height]);

}

var grid = paper.path(grid);
Expand Down

0 comments on commit 7630040

Please sign in to comment.