Wondering if someone can help, I am trying to create google charts using stacked bars and two lines.I am able to create with one line, but not sure how I can add another line into same chart. I want to show "Average2" as a line chart.
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
// Some raw data (not necessarily accurate)
var data = google.visualization.arrayToDataTable([
['Month', 'Bolivia', 'Ecuador', 'Average1' , 'Average2'],
['April', 165, 938, 614.6 , 400],
['May', 135, 1120, 682 , 500],
['June', 157, 1167, 623, 600],
['July', 139, 1110, 609.4, 450],
['August', 136, 691, 569.6 , 700]
]);
var options = {
title : 'Month (Q2-Q1 2015)',
vAxis: {title: ""},
hAxis: {title: ""},
isStacked: true,
seriesType: "bars",
series: {2: {type: "line"}},
};
var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['corechart']}]}"></script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
Try:
series: {2: {type: "line"}, 3: {type: "line"}},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With