I need to plot a 'line chart' and 'scatter chart' on the same graph.
How do i merge the two to show on the same chart. The current code is as
follows
// Draw Scatter Chart
> var data = new google.visualization.DataTable();
> data.addColumn('number', 'X');
> data.addColumn('number', 'Y');
> for (var i = 0; i < arr1.length; ++i) {
> data.addRow([eval(arr2[i]), eval(arr1[i])])
> }
> var options = {
> title: 'Line of Best Fit(Trend Line)',
> hAxis: {title: 'Independent Variable', minValue: 0, maxValue:
> 15},
> vAxis: {title: 'Dependent Variable', minValue: 0, maxValue: 15},
> legend: 'none'
> };
>
> var chart = new
> google.visualization.ScatterChart(document.getElementById('chart_div'));
> chart.draw(data, options);
>
> /* Draw Line Chart*/
> var lndata = new google.visualization.DataTable();
> lndata.addColumn('number', 'X');
> lndata.addColumn('number', 'Y');
> for (var i = 0; i < arr2.length; ++i) {
> data.addRow([eval(arr2[i]), eval(a + (b*arr2[i]))])
> }
>
>
>
> var lnchart = new
> google.visualization.LineChart(document.getElementById('chart_div1'));
> lnchart.draw(lndata, options);
>
How do I merge the two on the same chart ?
Thanks a lot :)
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/qYwC5Igwx50J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.