Categories
JavaScript Answers

How to remove color underneath lines from a Chart.js line charts with JavaScript?

Spread the love

Sometimes, we want to remove color underneath lines from a Chart.js line charts with JavaScript.

In this article, we’ll look at how to remove color underneath lines from a Chart.js line charts with JavaScript.

How to remove color underneath lines from a Chart.js line charts with JavaScript?

To remove color underneath lines from a Chart.js line charts with JavaScript, we set the fill option to false.

For instance, we write

const data = {
  labels: ["January", "February", "March", "April", "May", "June", "July"],
  datasets: [
    {
      label: "Dataset",
      fill: false,
      data: [1, 2, 3],
    },
  ],
};

to set fill to false to remove the color underneath the lines in the line chart.

Conclusion

To remove color underneath lines from a Chart.js line charts with JavaScript, we set the fill option to false.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.