I am trying to create a stacked bar chart using Google Charts. The data I
have is kind of jumpy, for example: Let's say I have a data set like this:
- 2001, A, 500
- 2001, B, 200
- 2001, C, 100
- 2002, B, 900
- 2002, C, 400
- 2003, A, 600
- 2003, C, 900
The columns are the year and the letter. In Google Charts, you would create
this chart like this:
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'A');
data.addColumn('number', 'B');
data.addColumn('number', 'C');
data.addRows([
['2001', 500, 200, 100],
['2002', undefined, 900, 400],
['2003', 600, undefined, 900],
]);
However, because the data is jumpy and it's not possible to know what comes
next, creating a chart like this becomes a headache. Is it possible to
create one row at a time like so:
data.addRow['2001', 'A', 500]; data.addRow['2001', 'B', 200], etc? So for
example, undefined columns that don't exist won't show up like 2002: A. Is
it possible to do something like this?
--
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 [email protected].
To post to this group, send email to [email protected].
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/2111b4a1-79de-42aa-afdd-0a272d8f3ab8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.