Combo charts

45 views
Skip to first unread message

w.inkomen

unread,
Nov 26, 2011, 4:19:21 PM11/26/11
to Google Visualization API
Hi all,

Is it possible to have mulitple type series defined in a combo-chart?
Beside the normal serie bars i would like to have multiple series of
lines crossing the bars.
See the altered example code from the code playground, creating 2
series (5 and 6) of type "line".
This code shows only series 6 in type line. How can I make both
series (5 and 6) work?

function drawVisualization() {
// Some raw data (not necessarily accurate)
var rowData = [['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua
Guinea',
'Rwanda', 'Average', 'high'],
['2004/05', 165, 938, 522, 998, 450, 700, 800],
['2005/06', 135, 1120, 599, 1268, 288, 700, 800],
['2006/07', 157, 1167, 587, 807, 397, 700, 800],
['2007/08', 139, 1110, 615, 968, 215, 700, 800],
['2008/09', 136, 691, 629, 1026, 366, 700, 800]];

// Create and populate the data table.
var data = google.visualization.arrayToDataTable(rowData);

// Create and draw the visualization.
var ac = new
google.visualization.ComboChart(document.getElementById('visualization'));
ac.draw(data, {
title : 'Monthly Coffee Production by Country',
width: 600,
height: 400,
vAxis: {title: "Cups"},
hAxis: {title: "Month"},
seriesType: "bars",
series: {5: {type: "line"}},
series: {6: {type: "line"}}
});
}​

Roni Biran

unread,
Nov 27, 2011, 12:22:50 AM11/27/11
to google-visua...@googlegroups.com
Sure thing. 
The series configuration option receives a list of series definition, so to get your desired output your series option should look like this:

series: {5: {type: "line"},{6: {type: "line"}}

And that should do the trick :-)

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

asgallant

unread,
Nov 29, 2011, 11:22:45 AM11/29/11
to google-visua...@googlegroups.com
A friendly typo correction, if I may (removes the extra '{' before the 6):

series: {5: {type: "line"},6: {type: "line"}}

Roni Biran

unread,
Nov 29, 2011, 11:23:57 AM11/29/11
to google-visua...@googlegroups.com
my bad - oops

On Tue, Nov 29, 2011 at 6:22 PM, asgallant <drew_g...@abtassoc.com> wrote:
A friendly typo correction, if I may (removes the extra '{' before the 6):

series: {5: {type: "line"},6: {type: "line"}}

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
Reply all
Reply to author
Forward
0 new messages