*/
/*global Dygraph:false */
-Dygraph.Plugins.Grid = (function() {
-
/*
Current bits of jankiness:
for (i = 0; i < ticks.length; i++) {
var axis = ticks[i][0];
if(drawGrid[axis]) {
+ ctx.save();
if (stroking[axis]) {
- ctx.installPattern(strokePattern[axis]);
+ if (ctx.setLineDash) ctx.setLineDash(strokePattern[axis]);
}
ctx.strokeStyle = strokeStyles[axis];
ctx.lineWidth = lineWidths[axis];
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + area.w, y);
- ctx.closePath();
ctx.stroke();
- if (stroking[axis]) {
- ctx.uninstallPattern();
- }
+ ctx.restore();
}
}
ctx.restore();
var strokePattern = g.getOptionForAxis('gridLinePattern', 'x');
var stroking = strokePattern && (strokePattern.length >= 2);
if (stroking) {
- ctx.installPattern(strokePattern);
+ if (ctx.setLineDash) ctx.setLineDash(strokePattern);
}
ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x');
ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x');
ctx.stroke();
}
if (stroking) {
- ctx.uninstallPattern();
+ if (ctx.setLineDash) ctx.setLineDash([]);
}
ctx.restore();
}
grid.prototype.destroy = function() {
};
-return grid;
-
-})();
+export default grid;