i try to hide the value inside the bars of my bar chart. The reason for that is that i placed the value on top of the bars, and the value should not be shown twice.
I tried different options to hide the value but it did not work.
In the following you can see a screenshot, i want to remove the numbers inside the bars.
Advertisement
Answer
Chart.js does not draw any data labels (values) itself by default. You most probably have activated (imported) a plugin such as chartjs-plugin-datalabels that draws these values:
JavaScript
x
2
1
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
2
Simply remove the script
tag from your code. To disable a global plugin for a specific chart instance only, the plugin options must be set to false
.
In the case of chartjs-plugin-datalabels
, this would be done as follows:
JavaScript
1
8
1
options: {
2
plugins: {
3
datalabels: {
4
display: false
5
}
6
},
7
}
8