I'm trying to create a Google chart using GoogleVisualr.
This input works:
data_table.add_rows([
['04/14', 1],
['04/15', 2],
['04/16', 3],
['04/17', 4],
['04/18', 5],
['04/19', 1],
['04/20', 12],
['04/21', 13],
['04/24', 14],
['04/14', 15],
['04/24', 16],
['04/22', 17],
['04/14', 18],
['04/4', 19],
])
I am currently using:
Product.find(:all, :order => "created_at ASC").each do |p|
data_table.add_rows([
[p.created_at.strftime("%m/%d"), p.rating]
])
which returns:
01/13
2
01/20
3
02/22
2
03/14
2
03/19
2
04/14
1
04/15
2
04/17
2
05/14
2
05/14
2
05/14
2
05/14
2...
How can I format my array to match what GoogleVisualr requires:
[ [data, value], [date, value]...]