I’m trying to make a radar chart with a dark background. White index labels distract from the chart itself.
I found a thread that raised a question about customizing index labels, but the code in the answer only works with version 2.1.3 or mb close to it.
Is it possible in chart.js@3.5.1?
Advertisement
Answer
You need to set display to false in the ticks like so:
JavaScript
x
29
29
1
const options = {
2
type: 'radar',
3
data: {
4
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
5
datasets: [{
6
label: '# of Votes',
7
data: [12, 19, 3, 5, 2, 3],
8
borderColor: 'pink'
9
}]
10
},
11
options: {
12
scales: {
13
r: {
14
angleLines: {
15
display: false
16
},
17
grid: {
18
display: false
19
},
20
ticks: {
21
display: false
22
}
23
}
24
}
25
}
26
}
27
28
const ctx = document.getElementById('chartJSContainer').getContext('2d');
29
new Chart(ctx, options);
JavaScript
1
4
1
<body>
2
<canvas id="chartJSContainer" width="600" height="400"></canvas>
3
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.js"></script>
4
</body>