9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/formatters/png_formatter.rb', line 9
def google_hash
out = options.to_hash.symbolize_keys
columns = out.delete(:columns) || data.column_names
if out[:legend] == false or skip_legend?
out.delete(:legend)
else
out[:legend] ||= columns
end
unless out[:data]
out[:data] = []
columns.each_with_index do |col, i|
out[:data][i] ||= []
end
data.each_with_index do |row, i|
columns.each_with_index do |col, i|
out[:data][i] << row[col]
end
end
end
out
end
|