Skip to content

Commit 7522c29

Browse files
committed
Remove zeroLineIndex functionality
1 parent e42413f commit 7522c29

File tree

9 files changed

+7
-45
lines changed

9 files changed

+7
-45
lines changed

docs/getting-started/v3-migration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`.
2626
### Customizability
2727

2828
* `custom` attribute of elements was removed. Please use scriptable options
29+
* The `zeroLine*` features of axes were removed.
2930

3031
### Options
3132

src/core/core.scale.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ defaults._set('scale', {
2424
drawOnChartArea: true,
2525
drawTicks: true,
2626
tickMarkLength: 10,
27-
zeroLineWidth: 1,
28-
zeroLineColor: 'rgba(0,0,0,0.25)',
29-
zeroLineBorderDash: [],
30-
zeroLineBorderDashOffset: 0.0,
3127
offsetGridLines: false,
3228
borderDash: [],
3329
borderDashOffset: 0.0
@@ -324,9 +320,6 @@ function skip(ticks, spacing, majorStart, majorEnd) {
324320
}
325321

326322
var Scale = Element.extend({
327-
328-
zeroLineIndex: 0,
329-
330323
/**
331324
* Parse a supported input value to internal representation.
332325
* @param {*} raw
@@ -1017,18 +1010,10 @@ var Scale = Element.extend({
10171010
continue;
10181011
}
10191012

1020-
if (i === me.zeroLineIndex && options.offset === offsetGridLines) {
1021-
// Draw the first index specially
1022-
lineWidth = gridLines.zeroLineWidth;
1023-
lineColor = gridLines.zeroLineColor;
1024-
borderDash = gridLines.zeroLineBorderDash || [];
1025-
borderDashOffset = gridLines.zeroLineBorderDashOffset || 0.0;
1026-
} else {
1027-
lineWidth = valueAtIndexOrDefault(gridLines.lineWidth, i, 1);
1028-
lineColor = valueAtIndexOrDefault(gridLines.color, i, 'rgba(0,0,0,0.1)');
1029-
borderDash = gridLines.borderDash || [];
1030-
borderDashOffset = gridLines.borderDashOffset || 0.0;
1031-
}
1013+
lineWidth = valueAtIndexOrDefault(gridLines.lineWidth, i, 1);
1014+
lineColor = valueAtIndexOrDefault(gridLines.color, i, 'rgba(0,0,0,0.1)');
1015+
borderDash = gridLines.borderDash || [];
1016+
borderDashOffset = gridLines.borderDashOffset || 0.0;
10321017

10331018
lineValue = getPixelForGridLine(me, tick._index || i, offsetGridLines);
10341019

src/scales/scale.linearbase.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ module.exports = Scale.extend({
234234
generateTickLabels: function(ticks) {
235235
var me = this;
236236
me._tickValues = ticks.map(t => t.value);
237-
me.zeroLineIndex = me._tickValues.indexOf(0);
238-
239237
Scale.prototype.generateTickLabels.call(me, ticks);
240238
},
241239

test/fixtures/core.scale/tick-drawing.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"gridLines":{
2020
"drawOnChartArea": false,
2121
"drawBorder": false,
22-
"color": "rgba(0, 0, 0, 1)",
23-
"zeroLineColor": "rgba(0, 0, 0, 1)"
22+
"color": "rgba(0, 0, 0, 1)"
2423
}
2524
}, {
2625
"type": "category",
@@ -32,8 +31,7 @@
3231
"gridLines":{
3332
"drawOnChartArea": false,
3433
"drawBorder": false,
35-
"color": "rgba(0, 0, 0, 1)",
36-
"zeroLineColor": "rgba(0, 0, 0, 1)"
34+
"color": "rgba(0, 0, 0, 1)"
3735
}
3836
}],
3937
"yAxes": [{

test/specs/scale.category.tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ describe('Category scale tests', function() {
2929
lineWidth: 1,
3030
offsetGridLines: false,
3131
display: true,
32-
zeroLineColor: 'rgba(0,0,0,0.25)',
33-
zeroLineWidth: 1,
34-
zeroLineBorderDash: [],
35-
zeroLineBorderDashOffset: 0.0,
3632
borderDash: [],
3733
borderDashOffset: 0.0
3834
},

test/specs/scale.linear.tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ describe('Linear Scale', function() {
2323
lineWidth: 1,
2424
offsetGridLines: false,
2525
display: true,
26-
zeroLineColor: 'rgba(0,0,0,0.25)',
27-
zeroLineWidth: 1,
28-
zeroLineBorderDash: [],
29-
zeroLineBorderDashOffset: 0.0,
3026
borderDash: [],
3127
borderDashOffset: 0.0
3228
},

test/specs/scale.logarithmic.tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ describe('Logarithmic Scale tests', function() {
2222
lineWidth: 1,
2323
offsetGridLines: false,
2424
display: true,
25-
zeroLineColor: 'rgba(0,0,0,0.25)',
26-
zeroLineWidth: 1,
27-
zeroLineBorderDash: [],
28-
zeroLineBorderDashOffset: 0.0,
2925
borderDash: [],
3026
borderDashOffset: 0.0
3127
},

test/specs/scale.radialLinear.tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ describe('Test the radial linear scale', function() {
3434
lineWidth: 1,
3535
offsetGridLines: false,
3636
display: true,
37-
zeroLineColor: 'rgba(0,0,0,0.25)',
38-
zeroLineWidth: 1,
39-
zeroLineBorderDash: [],
40-
zeroLineBorderDashOffset: 0.0,
4137
borderDash: [],
4238
borderDashOffset: 0.0
4339
},

test/specs/scale.time.tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ describe('Time scale tests', function() {
6969
lineWidth: 1,
7070
offsetGridLines: false,
7171
display: true,
72-
zeroLineColor: 'rgba(0,0,0,0.25)',
73-
zeroLineWidth: 1,
74-
zeroLineBorderDash: [],
75-
zeroLineBorderDashOffset: 0.0,
7672
borderDash: [],
7773
borderDashOffset: 0.0
7874
},

0 commit comments

Comments
 (0)