Categories
JavaScript Answers

How to remove padding or margins from Google Charts with JavaScript?

Spread the love

To remove padding or margins from Google Charts with JavaScript, we set the width and height of the chart area.

For instance, we write

const options = {
  title: "How Much Pizza I Ate",
  width: 350,
  height: 400,
  chartArea: { width: "100%", height: "80%" },
  legend: { position: "bottom" },
};

to set the chartArea‘s width and height to match the actual width and height to remove any padding or margin from the chart.

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 *