lib/axlsx/drawing/series.rb in axlsx-1.3.1 vs lib/axlsx/drawing/series.rb in axlsx-1.3.2
- old
+ new
@@ -4,10 +4,12 @@
# @note The recommended way to manage series is to use Chart#add_series
# @see Worksheet#add_chart
# @see Chart#add_series
class Series
+ include Axlsx::OptionsParser
+
# The chart that owns this series
# @return [Chart]
attr_reader :chart
# The title of the series
@@ -20,23 +22,19 @@
# @option options [String] title
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
+ parse_options options
end
-
# The index of this series in the chart's series.
# @return [Integer]
def index
@chart.series.index(self)
end
-
# The order of this series in the chart's series. By default the order is the index of the series.
# @return [Integer]
def order
@order || index
end
@@ -66,7 +64,6 @@
title.to_xml_string(str) unless title.nil?
yield str if block_given?
str << '</c:ser>'
end
end
-
end