Class: Axlsx::Series

Inherits:
Object
  • Object
show all
Includes:
OptionsParser
Defined in:
lib/axlsx/drawing/series.rb

Overview

Note:

The recommended way to manage series is to use Chart#add_series

A Series defines the common series attributes and is the super class for all concrete series types.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

Constructor Details

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

Creates a new series

Parameters:

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

    a customizable set of options

Options Hash (options):

  • order (Integer)
  • title (String)


21
22
23
24
25
26
# File 'lib/axlsx/drawing/series.rb', line 21

def initialize(chart, options = {})
  @order = nil
  self.chart = chart
  @chart.series << self
  parse_options options
end

Instance Attribute Details

#chartChart

The chart that owns this series

Returns:



11
12
13
# File 'lib/axlsx/drawing/series.rb', line 11

def chart
  @chart
end

#titleSeriesTitle

The title of the series

Returns:



15
16
17
# File 'lib/axlsx/drawing/series.rb', line 15

def title
  @title
end

Instance Method Details

#indexInteger

The index of this series in the chart's series.

Returns:

  • (Integer)


30
31
32
# File 'lib/axlsx/drawing/series.rb', line 30

def index
  @chart.series.index(self)
end

#orderInteger

The order of this series in the chart's series. By default the order is the index of the series.

Returns:

  • (Integer)


36
37
38
# File 'lib/axlsx/drawing/series.rb', line 36

def order
  @order || index
end

#order=(v) ⇒ Object

See Also:



41
# File 'lib/axlsx/drawing/series.rb', line 41

def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end