My current project involves creating a chart with Google Chart Tools.
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([
[<%= @months %>, <%= @money %>]
]);
var options = {
title: 'Title'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div_2'));
chart.draw(data, options);
}
When attempting to pass arrays for @months and @money, the chart does not display as expected. How should I handle this situation?
UPDATE
After using Gon and implementing the setCell function in a loop, the issue is now resolved and the chart appears correctly.