112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/geoptima/chart.rb', line 112
def chart
unless @chart
case chart_type.to_s
when 'line'
@chart = Gruff::Line.new(options[:width])
@chart.hide_dots = !options[:show_points]
@chart.hide_lines = !options[:show_lines]
when 'bar'
@chart = Gruff::Bar.new(options[:width])
when 'side_bar'
@chart = Gruff::SideBar.new(options[:width])
else
raise "Unsupported chart type: #{chart_type}"
end
@chart.title = options[:title]
@chart.margins = options[:margins]
@chart.legend_font_size = options[:font_size]
@chart.marker_font_size = options[:font_size]
@chart.title_font_size = options[:title_font_size] || 2 * options[:font_size]
end
@chart
end
|