Method: Writexlsx::Chart.factory
- Defined in:
- lib/write_xlsx/chart.rb
.factory(current_subclass, subtype = nil) ⇒ Object
Factory method for returning chart objects based on their class type.
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/write_xlsx/chart.rb', line 183 def self.factory(current_subclass, subtype = nil) # :nodoc: case current_subclass.downcase.capitalize when 'Area' require 'write_xlsx/chart/area' Chart::Area.new(subtype) when 'Bar' require 'write_xlsx/chart/bar' Chart::Bar.new(subtype) when 'Column' require 'write_xlsx/chart/column' Chart::Column.new(subtype) when 'Doughnut' require 'write_xlsx/chart/doughnut' Chart::Doughnut.new(subtype) when 'Line' require 'write_xlsx/chart/line' Chart::Line.new(subtype) when 'Pie' require 'write_xlsx/chart/pie' Chart::Pie.new(subtype) when 'Radar' require 'write_xlsx/chart/radar' Chart::Radar.new(subtype) when 'Scatter' require 'write_xlsx/chart/scatter' Chart::Scatter.new(subtype) when 'Stock' require 'write_xlsx/chart/stock' Chart::Stock.new(subtype) end end |