Method: Axlsx::Worksheet#add_chart

Defined in:
lib/axlsx/workbook/worksheet/worksheet.rb

#add_chart(chart_type, options = {}) {|chart| ... } ⇒ Object

Note:

each chart type also specifies additional options

Adds a chart to this worksheets drawing. This is the recommended way to create charts for your worksheet. This method wraps the complexity of dealing with ooxml drawing, anchors, markers graphic frames chart objects and all the other dirty details.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • start_at (Array)
  • end_at (Array)
  • title (Cell, String)
  • show_legend (Boolean)
  • style (Integer)

Yields:

  • (chart)

See Also:



421
422
423
424
425
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 421

def add_chart(chart_type, options={})
  chart = worksheet_drawing.add_chart(chart_type, options)
  yield chart if block_given?
  chart
end