Secondary y axis values not displayed in Google Charts -
i trying use secondary y axis google charts.
i have code:
arrdata.addrows([ [observationdatetime, observationvaluecd4, observationvalueviralload] ]); } // start of drawchart() var options2 = { title: 'cd4 && viralload v/s datetime', vaxes: [{ title: 'cd4', textstyle: { color: 'blue' } }, // axis 0 { title: 'viral load', textstyle: { color: 'red' } } // axis 1 ], haxis: { title: "date" }, series: { 0: { type: "bars", targetaxisindex: 0 }, 1: { type: "line", targetaxisindex: 1 } } };
however, bit confused rendered: renders blue straight vertical lines pointing , no red line.though secondary y axes in rendered.
what expect: expect blue bars values on left y axis , red line values on right y axes.
without more code or sample data can't sure issue options seem correct want.
google.load("visualization", "1", { packages: ["corechart"] }); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ["observationdatetime", "observationvaluecd4", "observationvalueviralload"], [new date(2015,1,1), 9, 4], [new date(2015,2,1), 11, 6], [new date(2015,3,1), 20, 2], [new date(2015,4,1), 21, 3] ]); var options2 = { title: 'cd4 && viralload v/s datetime', vaxes: [{ title: 'cd4', textstyle: { color: 'blue' } }, // axis 0 { title: 'viral load', textstyle: { color: 'red' } } // axis 1 ], haxis: { title: "date" }, series: { 0: { type: "bars", targetaxisindex: 0 }, 1: { type: "line", targetaxisindex: 1 } } }; var chart = new google.visualization.linechart(document.getelementbyid("chart")); chart.draw(data, options2); } // start of drawchart()
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <div id="chart" style="width: 900px; height: 300px;"></div>
Comments
Post a Comment