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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *