Class: Axlsx::LineSeries

Inherits:
Series
  • Object
show all
Defined in:
lib/axlsx/drawing/line_series.rb

Overview

Note:

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

A LineSeries defines the title, data and labels for line charts

Instance Attribute Summary collapse

Attributes inherited from Series

#chart, #title

Instance Method Summary collapse

Methods inherited from Series

#index, #order, #order=

Constructor Details

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

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)


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

def initialize(chart, options={})
  @labels, @data = nil, nil
  super(chart, options)
  @labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
  @data = ValAxisData.new(options[:data]) unless options[:data].nil?
end

Instance Attribute Details

#dataValAxisData

The data for this series.

Returns:



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

def data
  @data
end

#labelsCatAxisData

The labels for this series.

Returns:



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

def labels
  @labels
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


31
32
33
34
35
36
# File 'lib/axlsx/drawing/line_series.rb', line 31

def to_xml_string(str = '')
  super(str) do
    @labels.to_xml_string(str) unless @labels.nil?
    @data.to_xml_string(str) unless @data.nil?
  end
end