Skip to content

Commit fed9762

Browse files
stockiNailsimonbrunel
authored andcommitted
Fix drawing order when elements are skipped (chartjs#323)
1 parent cdc2e94 commit fed9762

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

src/layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default {
106106
_hidable: false,
107107
_visible: true,
108108
_set: i,
109-
_idx: j
109+
_idx: label._index
110110
};
111111
}
112112
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// https://github.com/chartjs/chartjs-plugin-datalabels/issues/319
2+
3+
export default {
4+
config: {
5+
type: 'radar',
6+
data: {
7+
labels: ['1', '2', '3', '4', '5'],
8+
datasets: [
9+
{
10+
label: 'Series 1',
11+
data: [5, 5, 5, 5, 5],
12+
backgroundColor: 'red',
13+
borderWidth: 0,
14+
fill: false,
15+
borderColor: 'red',
16+
datalabels: {
17+
backgroundColor: 'red',
18+
}
19+
},
20+
{
21+
label: 'Series 2',
22+
data: [4.5, 4.5, null, 4.5, 4.5],
23+
backgroundColor: 'blue',
24+
borderWidth: 0,
25+
fill: false,
26+
borderColor: 'blue',
27+
datalabels: {
28+
backgroundColor: 'blue',
29+
}
30+
}
31+
]
32+
},
33+
options: {
34+
layout: {
35+
padding: 20
36+
},
37+
scales: {
38+
r: {
39+
display: false,
40+
min: 1,
41+
max: 5
42+
},
43+
},
44+
plugins: {
45+
datalabels: {
46+
font: {
47+
size: 0
48+
},
49+
padding: 16,
50+
}
51+
}
52+
53+
}
54+
},
55+
options: {
56+
canvas: {
57+
height: 256,
58+
width: 256
59+
}
60+
}
61+
};
2.68 KB
Loading

0 commit comments

Comments
 (0)