"use strict";
-
/**
* Draws the gridlines, i.e. the gray horizontal & vertical lines running the
* length of the chart.
ticks = layout.yticks;
ctx.save();
// draw grids for the different y axes
- for (var tick of ticks) {
- if (!tick.has_tick) continue;
+ ticks.forEach(tick => {
+ if (!tick.has_tick) return;
var axis = tick.axis;
if (drawGrid[axis]) {
ctx.save();
ctx.restore();
}
- }
+ });
ctx.restore();
}
}
ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x');
ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x');
- for (var tick of ticks) {
- if (!tick.has_tick) continue;
+ ticks.forEach(tick => {
+ if (!tick.has_tick) return;
x = halfUp(area.x + tick.pos * area.w);
y = halfDown(area.y + area.h);
ctx.beginPath();
ctx.lineTo(x, area.y);
ctx.closePath();
ctx.stroke();
- }
+ });
if (stroking) {
if (ctx.setLineDash) ctx.setLineDash([]);
}