Method: Axlsx::Chart#initialize

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

#initialize(frame, options = {}) {|_self| ... } ⇒ Chart

Creates a new chart object

Parameters:

  • frame (GraphicalFrame)

    The frame that holds this chart.

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

    a customizable set of options

Options Hash (options):

  • title (Cell, String)
  • show_legend (Boolean)
  • legend_position (Symbol)
  • start_at (Array|String|Cell)

    The X, Y coordinates defining the top left corner of the chart.

  • end_at (Array|String|Cell)

    The X, Y coordinates defining the bottom right corner of the chart.

Yields:

  • (_self)

Yield Parameters:

  • _self (Axlsx::Chart)

    the object that the method was called on



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/axlsx/drawing/chart.rb', line 17

def initialize(frame, options={})
  @style = 18
  @view_3D = nil
  @graphic_frame=frame
  @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
  @series = SimpleTypedList.new Series
  @show_legend = true
  @legend_position = :r
  @display_blanks_as = :gap
  @series_type = Series
  @title = Title.new
  @bg_color = nil
  parse_options options
  start_at(*options[:start_at]) if options[:start_at]
  end_at(*options[:end_at]) if options[:end_at]
  yield self if block_given?
end