Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google BarChart set width of bars?

Tags:

I'm generating a BarChart with Google's javascript visualization libraries. I would like to make the bars in the chart to be wider than they currently are, but I can't find anything in the documentation which shows how to configure the width of the bars of each data set.

Any help?

like image 610
Kenny Wyland Avatar asked Jul 15 '11 02:07

Kenny Wyland


People also ask

How do you change the width of a bar in a Google chart?

Right-click on any column inside your chart. Select 'Format data series'. Drag the slider under the 'Gap width' to the right to make the columns thinner and to the left to make the columns wider.

How do I make my bars wider on a bar chart?

Click on any bar in the Bar Chart and right click on it, then select Format Data Series from the right-clicking menu. See screenshot: 2. In the popping up Format Data Series pane, move the Zoom bar of the Gap Width to the left side until the bar width meets your needs under the Series Options section.

Can the bars of a bar graph be different widths?

A bar graph is a pictorial representation of the numerical data by a number of bars of uniform width erected horizontally or vertically with equal spacing between them. The height of the bars may vary but width remains the same.


1 Answers

Had this same question, figured I'd post for posterity. The bar.groupWidth appears to be the way to set this.

https://developers.google.com/chart/interactive/docs/gallery/barchart

For example:

 var options = {
        title: "Density of Precious Metals, in g/cm^3",
        width: 600,
        height: 400,
        bar: {groupWidth: "95%"},
        legend: { position: "none" },
      };
 var chart = new google.visualization.BarChart(document.getElementById("barchart_values"));
 chart.draw(view, options);
like image 177
Josh Rumbut Avatar answered Sep 17 '22 15:09

Josh Rumbut