]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Use consistent option context for scales (#7499)
authorEvert Timberg <evert.timberg+github@gmail.com>
Fri, 12 Jun 2020 22:01:48 +0000 (18:01 -0400)
committerGitHub <noreply@github.com>
Fri, 12 Jun 2020 22:01:48 +0000 (18:01 -0400)
src/core/core.scale.js

index 5e364085620fb5e2b3ab7167a41638656b88fb7b..c7fc1e45de026a1597b146f81d6136a3c0de6212 100644 (file)
@@ -1119,8 +1119,10 @@ export default class Scale extends Element {
                const items = [];
 
                let context = {
+                       chart,
                        scale: me,
                        tick: ticks[0],
+                       index: 0,
                };
                const axisWidth = gridLines.drawBorder ? resolve([gridLines.borderWidth, gridLines.lineWidth, 0], context, 0) : 0;
                const axisHalfWidth = axisWidth / 2;
@@ -1187,8 +1189,10 @@ export default class Scale extends Element {
                        const tick = ticks[i] || {};
 
                        context = {
+                               chart,
                                scale: me,
                                tick,
+                               index: i,
                        };
 
                        const lineWidth = resolve([gridLines.lineWidth], context, i);
@@ -1328,8 +1332,10 @@ export default class Scale extends Element {
                const ctx = me.ctx;
                const chart = me.chart;
                let context = {
+                       chart,
                        scale: me,
                        tick: me.ticks[0],
+                       index: 0,
                };
                const axisWidth = gridLines.drawBorder ? resolve([gridLines.borderWidth, gridLines.lineWidth, 0], context, 0) : 0;
                const items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));
@@ -1372,8 +1378,10 @@ export default class Scale extends Element {
                        // Draw the line at the edge of the axis
                        const firstLineWidth = axisWidth;
                        context = {
+                               chart,
                                scale: me,
                                tick: me.ticks[me._ticksLength - 1],
+                               index: me._ticksLength - 1,
                        };
                        const lastLineWidth = resolve([gridLines.lineWidth, 1], context, me._ticksLength - 1);
                        const borderValue = me._borderValue;