var gridLines = options.gridLines;
var scaleLabel = options.scaleLabel;
- var setContextLineSettings;
var isRotated = me.labelRotation !== 0;
var skipRatio;
var scaleLabelX;
context.fillStyle = tickFontColor;
if (me.isHorizontal()) {
- setContextLineSettings = true;
var yTickStart = options.position === "bottom" ? me.top : me.bottom - tl;
var yTickEnd = options.position === "bottom" ? me.top + tl : me.bottom;
skipRatio = false;
// Draw the first index specially
context.lineWidth = gridLines.zeroLineWidth;
context.strokeStyle = gridLines.zeroLineColor;
- setContextLineSettings = true; // reset next time
- } else if (setContextLineSettings) {
- context.lineWidth = gridLines.lineWidth;
- context.strokeStyle = gridLines.color;
- setContextLineSettings = false;
+ } else {
+ context.lineWidth = helpers.getValueAtIndexOrDefault(gridLines.lineWidth, index);
+ context.strokeStyle = helpers.getValueAtIndexOrDefault(gridLines.color, index);
}
xLineValue += helpers.aliasPixel(context.lineWidth);
}
} else {
- setContextLineSettings = true;
var xTickStart = options.position === "right" ? me.left : me.right - 5;
var xTickEnd = options.position === "right" ? me.left + 5 : me.right;
// Draw the first index specially
context.lineWidth = gridLines.zeroLineWidth;
context.strokeStyle = gridLines.zeroLineColor;
- setContextLineSettings = true; // reset next time
- } else if (setContextLineSettings) {
- context.lineWidth = gridLines.lineWidth;
- context.strokeStyle = gridLines.color;
- setContextLineSettings = false;
+ } else {
+ context.lineWidth = helpers.getValueAtIndexOrDefault(gridLines.lineWidth, index);
+ context.strokeStyle = helpers.getValueAtIndexOrDefault(gridLines.color, index);
}
yLineValue += helpers.aliasPixel(context.lineWidth);
if (gridLines.drawBorder) {
// Draw the line at the edge of the axis
- context.lineWidth = gridLines.lineWidth;
- context.strokeStyle = gridLines.color;
+ context.lineWidth = helpers.getValueAtIndexOrDefault(gridLines.lineWidth, 0);
+ context.strokeStyle = helpers.getValueAtIndexOrDefault(gridLines.color, 0);
var x1 = me.left,
x2 = me.right,
y1 = me.top,