Class: Axlsx::Series
- Inherits:
-
Object
- Object
- Axlsx::Series
- Defined in:
- lib/axlsx/drawing/series.rb
Overview
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.
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Chart) chart
The chart that owns this series.
-
- (Integer) index
readonly
The index of this series in the chart’s series.
-
- (Integer) order
The order of this series in the chart’s series.
-
- (SeriesTitle) title
The title of the series.
Instance Method Summary (collapse)
-
- (Series) initialize(chart, options = {})
constructor
Creates a new series.
-
- (String) to_xml(xml)
Serializes the series.
Constructor Details
- (Series) initialize(chart, options = {})
Creates a new series
28 29 30 31 32 33 34 |
# File 'lib/axlsx/drawing/series.rb', line 28 def initialize(chart, ={}) self.chart = chart @chart.series << self .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
10 11 12 |
# File 'lib/axlsx/drawing/series.rb', line 10 def chart @chart end |
- (Integer) index (readonly)
The index of this series in the chart’s series.
14 15 16 |
# File 'lib/axlsx/drawing/series.rb', line 14 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.
18 19 20 |
# File 'lib/axlsx/drawing/series.rb', line 18 def order @order || index end |
- (SeriesTitle) title
The title of the series
22 23 24 |
# File 'lib/axlsx/drawing/series.rb', line 22 def title @title end |
Instance Method Details
- (String) to_xml(xml)
Serializes the series
60 61 62 63 64 65 66 67 |
# File 'lib/axlsx/drawing/series.rb', line 60 def to_xml(xml) xml.send('c:ser') { xml.send('c:idx', :val=>index) xml.send('c:order', :val=>order || index) title.to_xml(xml) unless title.nil? yield xml if block_given? } end |