diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index 23e207bd5d9..1e3f7969093 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -578,7 +578,7 @@ export default class RadialLinearScale extends LinearScaleBase { if (grid.display) { this.ticks.forEach((tick, index) => { - if (index !== 0) { + if (index !== 0 || (index === 0 && this.min < 0)) { offset = this.getDistanceFromCenterForValue(tick.value); const context = this.getContext(index); const optsAtIndex = grid.setContext(context); @@ -645,7 +645,7 @@ export default class RadialLinearScale extends LinearScaleBase { ctx.textBaseline = 'middle'; this.ticks.forEach((tick, index) => { - if (index === 0 && !opts.reverse) { + if ((index === 0 && this.min >= 0) && !opts.reverse) { return; } diff --git a/test/fixtures/scale.radialLinear/ticks-below-zero.js b/test/fixtures/scale.radialLinear/ticks-below-zero.js new file mode 100644 index 00000000000..75647815ab5 --- /dev/null +++ b/test/fixtures/scale.radialLinear/ticks-below-zero.js @@ -0,0 +1,45 @@ +module.exports = { + config: { + type: 'radar', + data: { + labels: ['A', 'B', 'C', 'D', 'E'] + }, + options: { + responsive: false, + scales: { + r: { + min: -1, + max: 1, + grid: { + display: true, + color: 'blue', + lineWidth: 2 + }, + angleLines: { + color: 'rgba(255, 255, 255, 0.5)', + lineWidth: 2 + }, + pointLabels: { + display: false + }, + ticks: { + display: true, + autoSkip: false, + stepSize: 0.2, + callback: function(value) { + if (value === 0.8) { + return 'Strong'; + } + if (value === 0.4) { + return 'Weak'; + } + if (value === 0) { + return 'No'; + } + } + } + } + } + } + } +}; diff --git a/test/fixtures/scale.radialLinear/ticks-below-zero.png b/test/fixtures/scale.radialLinear/ticks-below-zero.png new file mode 100644 index 00000000000..36435fd1e1c Binary files /dev/null and b/test/fixtures/scale.radialLinear/ticks-below-zero.png differ