Stacked bar chart with data from Sheets?

2,673 views
Skip to first unread message

Greg Sommerville

unread,
May 19, 2016, 10:15:12 AM5/19/16
to Google Visualization API
I'd like to set up a Google Sheets spreadsheet with data for a stacked bar chart, but I can't figure out the best way to structure the sheet (or query it).

Does anyone have an example of how to use data from a Sheets document, resulting in a stacked bar chart?  All of the examples I've seen show JavaScript literal data, which is usually an array of arrays. 

Thanks!

Daniel LaLiberte

unread,
May 19, 2016, 10:28:02 AM5/19/16
to Google Visualization API
The BarChart is basically the same as the ColumnChart with a different orientation.  The data is the same for both.  The first column is for the domain, which on the BarChart is displayed along the vertical or y-axis.  The other columns are for series (and roles applied to the series).  Hope that helps.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/ecdb7fe0-9caf-4cf6-a213-38e6127875af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Greg Sommerville

unread,
May 19, 2016, 10:39:00 AM5/19/16
to Google Visualization API
Yes, that's what I did.  Column A is my main item, and columns B - E have data that relate to that main item.  I'd like to have columns B-E used as the parts of the stacked bar - in other words, each row of my spreadsheet resulting in a separate bar.  Unfortunately, I get an error (something like, "All data has to be of the same type"). 

I'm not sure whether I should be using the /range suffix, or add a query.  I really just want columns A through E, as I've described above.

Thanks for the help.


On Thursday, May 19, 2016 at 10:28:02 AM UTC-4, Daniel LaLiberte wrote:
The BarChart is basically the same as the ColumnChart with a different orientation.  The data is the same for both.  The first column is for the domain, which on the BarChart is displayed along the vertical or y-axis.  The other columns are for series (and roles applied to the series).  Hope that helps.
On Thu, May 19, 2016 at 10:15 AM, Greg Sommerville <gregsomm...@gmail.com> wrote:
I'd like to set up a Google Sheets spreadsheet with data for a stacked bar chart, but I can't figure out the best way to structure the sheet (or query it).

Does anyone have an example of how to use data from a Sheets document, resulting in a stacked bar chart?  All of the examples I've seen show JavaScript literal data, which is usually an array of arrays. 

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

Daniel LaLiberte

unread,
May 19, 2016, 1:29:52 PM5/19/16
to Google Visualization API
If you actually have more data in your spreadsheet that you don't want to be part of this chart, then you will need the range parameter.  Make sure you have formatted these data columns as numbers.  

A good debugging technique is to show the data in a Table chart, just to see what you are getting.

On Thu, May 19, 2016 at 10:38 AM, Greg Sommerville <gregsomm...@gmail.com> wrote:
Yes, that's what I did.  Column A is my main item, and columns B - E have data that relate to that main item.  I'd like to have columns B-E used as the parts of the stacked bar - in other words, each row of my spreadsheet resulting in a separate bar.  Unfortunately, I get an error (something like, "All data has to be of the same type"). 

I'm not sure whether I should be using the /range suffix, or add a query.  I really just want columns A through E, as I've described above.

Thanks for the help.


On Thursday, May 19, 2016 at 10:28:02 AM UTC-4, Daniel LaLiberte wrote:
The BarChart is basically the same as the ColumnChart with a different orientation.  The data is the same for both.  The first column is for the domain, which on the BarChart is displayed along the vertical or y-axis.  The other columns are for series (and roles applied to the series).  Hope that helps.
On Thu, May 19, 2016 at 10:15 AM, Greg Sommerville <gregsomm...@gmail.com> wrote:
I'd like to set up a Google Sheets spreadsheet with data for a stacked bar chart, but I can't figure out the best way to structure the sheet (or query it).

Does anyone have an example of how to use data from a Sheets document, resulting in a stacked bar chart?  All of the examples I've seen show JavaScript literal data, which is usually an array of arrays. 

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.



--

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages