Method: Gruff::Base#initialize
- Defined in:
- lib/gruff/base.rb
#initialize(target_width = DEFAULT_TARGET_WIDTH) ⇒ Base
If one numerical argument is given, the graph is drawn at 4/3 ratio according to the given width (800 results in 800x600, 400 gives 400x300, etc.).
Or, send a geometry string for other ratios ( ‘800x400’, ‘400x225’).
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/gruff/base.rb', line 137 def initialize(target_width = DEFAULT_TARGET_WIDTH) if target_width.is_a?(String) @columns, @rows = target_width.split('x').map(&:to_f) else @columns = target_width.to_f @rows = target_width.to_f * 0.75 end @columns.freeze @rows.freeze @has_left_labels = false @center_labels_over_point = true initialize_graph_scale initialize_attributes initialize_store self.theme = Themes::KEYNOTE end |