Class: Axlsx::Series

Inherits:
Object
  • Object
show all
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.

See Also:

Direct Known Subclasses

BarSeries, LineSeries, PieSeries

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Series) initialize(chart, options = {})

Creates a new series

Parameters:

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

    a customizable set of options

Options Hash (options):

  • order (Integer)
  • title (String)


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

def initialize(chart, options={})
  @order = nil
  self.chart = chart
  @chart.series << self
  options.each do |o|
    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
  end
end

Instance Attribute Details

- (Chart) chart

The chart that owns this series

Returns:



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

def chart
  @chart
end

- (SeriesTitle) title

The title of the series

Returns:



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

def title
  @title
end

Instance Method Details

- (Integer) index

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

Returns:

  • (Integer)


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

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

- (Integer) order

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

Returns:

  • (Integer)


38
39
40
# File 'lib/axlsx/drawing/series.rb', line 38

def order
  @order || index
end

- (Object) order=(v)

See Also:

  • order


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

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