summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/series.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2011-11-26 13:20:57 +0900
committerRandy Morgan <[email protected]>2011-11-26 13:20:57 +0900
commit11303a4d6664d9a7ff7bc408035d2ab70378a375 (patch)
tree51c675ae3ab8cd6c1afd7087145261b1eb2ec54c /lib/axlsx/drawing/series.rb
parent044afe5a35db42cefce4f18a0fecc3da90cab1b5 (diff)
downloadcaxlsx-11303a4d6664d9a7ff7bc408035d2ab70378a375.tar.gz
caxlsx-11303a4d6664d9a7ff7bc408035d2ab70378a375.zip
adding in support for ruby 1.9.3
release version 1.0.9
Diffstat (limited to 'lib/axlsx/drawing/series.rb')
-rw-r--r--lib/axlsx/drawing/series.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb
index cb5d6a8d..3647f22e 100644
--- a/lib/axlsx/drawing/series.rb
+++ b/lib/axlsx/drawing/series.rb
@@ -9,40 +9,40 @@ module Axlsx
# @return [Chart]
attr_reader :chart
- # The index of this series in the chart's series.
- # @return [Integer]
- attr_reader :index
-
- # The order of this series in the chart's series. By default the order is the index of the series.
- # @return [Integer]
- attr_accessor :order
-
# The title of the series
# @return [SeriesTitle]
- attr_accessor :title
+ attr_reader :title
# Creates a new series
# @param [Chart] chart
# @option options [Integer] order
# @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
end
-
+
+ # The index of this series in the chart's series.
+ # @return [Integer]
def index
@chart.series.index(self)
end
- def order=(v) Axlsx::validate_unsigned_int(v); @order = v; 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
+ # @see order
+ def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end
+
+ # @see title
def title=(v)
v = SeriesTitle.new(v) if v.is_a?(String) || v.is_a?(Cell)
DataTypeValidator.validate "#{self.class}.title", SeriesTitle, v