class Axlsx::Series
A Series
defines the common series attributes and is the super class for all concrete series types. @note The recommended way to manage series is to use Chart#add_series
@see Worksheet#add_chart
@see Chart#add_series
Attributes
chart[R]
The chart that owns this series @return [Chart]
title[R]
The title of the series @return [SeriesTitle]
Public Class Methods
new(chart, options={})
click to toggle source
Creates a new series @param [Chart] chart @option options [Integer] order @option options [String] title
# File lib/axlsx/drawing/series.rb, line 23 def initialize(chart, options={}) @order = nil self.chart = chart @chart.series << self parse_options options end
Public Instance Methods
index()
click to toggle source
The index of this series in the chart’s series. @return [Integer]
# File lib/axlsx/drawing/series.rb, line 32 def index @chart.series.index(self) end
order()
click to toggle source
The order of this series in the chart’s series. By default the order is the index of the series. @return [Integer]
# File lib/axlsx/drawing/series.rb, line 38 def order @order || index end
order=(v)
click to toggle source
@see order
# File lib/axlsx/drawing/series.rb, line 43 def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end
title=(v)
click to toggle source
@see title
# File lib/axlsx/drawing/series.rb, line 46 def title=(v) v = SeriesTitle.new(v) if v.is_a?(String) || v.is_a?(Cell) DataTypeValidator.validate "#{self.class}.title", SeriesTitle, v @title = v end
Private Instance Methods
chart=(v)
click to toggle source
assigns the chart for this series
# File lib/axlsx/drawing/series.rb, line 55 def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end
to_xml_string(str = '') { || ... }
click to toggle source
Serializes the object @param [String] str @return [String]
# File lib/axlsx/drawing/series.rb, line 60 def to_xml_string(str = '') str << '<c:ser>' str << ('<c:idx val="' << index.to_s << '"/>') str << ('<c:order val="' << (order || index).to_s << '"/>') title.to_xml_string(str) unless title.nil? yield if block_given? str << '</c:ser>' end