Skip to content

Commit 4068bd8

Browse files
authored
fix #11503, autoskipping 0 ticks when min is below 0 (#11682)
1 parent ef5e4d4 commit 4068bd8

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

src/scales/scale.radialLinear.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ export default class RadialLinearScale extends LinearScaleBase {
578578

579579
if (grid.display) {
580580
this.ticks.forEach((tick, index) => {
581-
if (index !== 0) {
581+
if (index !== 0 || (index === 0 && this.min < 0)) {
582582
offset = this.getDistanceFromCenterForValue(tick.value);
583583
const context = this.getContext(index);
584584
const optsAtIndex = grid.setContext(context);
@@ -645,7 +645,7 @@ export default class RadialLinearScale extends LinearScaleBase {
645645
ctx.textBaseline = 'middle';
646646

647647
this.ticks.forEach((tick, index) => {
648-
if (index === 0 && !opts.reverse) {
648+
if ((index === 0 && this.min >= 0) && !opts.reverse) {
649649
return;
650650
}
651651

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module.exports = {
2+
config: {
3+
type: 'radar',
4+
data: {
5+
labels: ['A', 'B', 'C', 'D', 'E']
6+
},
7+
options: {
8+
responsive: false,
9+
scales: {
10+
r: {
11+
min: -1,
12+
max: 1,
13+
grid: {
14+
display: true,
15+
color: 'blue',
16+
lineWidth: 2
17+
},
18+
angleLines: {
19+
color: 'rgba(255, 255, 255, 0.5)',
20+
lineWidth: 2
21+
},
22+
pointLabels: {
23+
display: false
24+
},
25+
ticks: {
26+
display: true,
27+
autoSkip: false,
28+
stepSize: 0.2,
29+
callback: function(value) {
30+
if (value === 0.8) {
31+
return 'Strong';
32+
}
33+
if (value === 0.4) {
34+
return 'Weak';
35+
}
36+
if (value === 0) {
37+
return 'No';
38+
}
39+
}
40+
}
41+
}
42+
}
43+
}
44+
}
45+
};
Loading

0 commit comments

Comments
 (0)