Method: Axlsx::BarSeries#initialize

Defined in:
lib/axlsx/drawing/bar_series.rb

#initialize(chart, options = {}) ⇒ BarSeries

Creates a new series

Parameters:

  • chart (Chart)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • data (Array, SimpleTypedList)
  • labels (Array, SimpleTypedList)
  • title (String)
  • shape (String)
  • colors (String)

    an array of colors to use when rendering each data point

  • series_color (String)

    a color to use when rendering series



37
38
39
40
41
42
43
# File 'lib/axlsx/drawing/bar_series.rb', line 37

def initialize(chart, options = {})
  @shape = :box
  @colors = []
  super
  self.labels = AxDataSource.new({ data: options[:labels] }) unless options[:labels].nil?
  self.data = NumDataSource.new(options) unless options[:data].nil?
end