Sometimes, we want to hide points in Chart.js line graph with JavaScript.
In this article, we’ll look at how to hide points in Chart.js line graph with JavaScript.
How to hide points in Chart.js line graph with JavaScript?
To hide points in Chart.js line graph with JavaScript,. we can set the pointRadius
option to 0.
For instance, we write
const myChart = new Chart(ctx, {
type: "line",
data: {
labels: [
//...
],
datasets: [
{
data: [
//...
],
pointRadius: 0,
},
],
},
options: {},
});
to create a new chart with the Chart
constructor.
We call it with an object that has the pointRadius
property set to 0 in the object in the datasets
array.
As a result, the points on the line graph will be hidden.
Conclusion
To hide points in Chart.js line graph with JavaScript,. we can set the pointRadius
option to 0.