Hi.
I am trying to draw a chart using Google Chart Tools, unfortunately I have
troubles with passing data form my array with financial data into row in
Google Charts. I use Ruby on Rails, and Gon <https://github.com/gazay/gon> to
pass array from rails controller to javaScript. How can I put automatically
my whole array into Google Chart rows?
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Month');
data.addColumn('number', 'Money');
data.addRows([
[ gon.months, gon.money]
]);
var options = {
title: 'Title'
};
var chart = new
google.visualization.LineChart(document.getElementById('chart_div_2'));
chart.draw(data, options);
}
In above code I' ve put my to arrays (gon.months and gon,money) into single
row, but it's not probably a good approach.
--
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/-/xSmW_fJseZoJ.
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.