summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/chart.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/chart.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/chart.rb')
-rw-r--r--lib/axlsx/drawing/chart.rb36
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb
index 6be9cbfe..45c75bda 100644
--- a/lib/axlsx/drawing/chart.rb
+++ b/lib/axlsx/drawing/chart.rb
@@ -21,29 +21,21 @@ module Axlsx
# @return [Series]
attr_reader :series_type
- # The index of this chart in the workbooks charts collection
- # @return [Integer]
- attr_reader :index
-
- # The part name for this chart
- # @return [String]
- attr_reader :pn
-
#TODO data labels!
- #attr_accessor :dLabls
+ #attr_reader :dLabls
# The title object for the chart.
# @return [Title]
- attr_accessor :title
+ attr_reader :title
# The style for the chart.
# see ECMA Part 1 §21.2.2.196
# @return [Integer]
- attr_accessor :style
+ attr_reader :style
# Show the legend in the chart
# @return [Boolean]
- attr_accessor :show_legend
+ attr_reader :show_legend
# Creates a new chart object
# @param [GraphicalFrame] frame The frame that holds this chart.
@@ -59,28 +51,42 @@ module Axlsx
options.each do |o|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
end
- start_at *options[:start_at] if options[:start_at]
- end_at *options[:end_at] if options[:start_at]
+ start_at(*options[:start_at]) if options[:start_at]
+ end_at(*options[:end_at]) if options[:start_at]
yield self if block_given?
end
+ # The index of this chart in the workbooks charts collection
+ # @return [Integer]
def index
@graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)
end
+ # The part name for this chart
+ # @return [String]
def pn
"#{CHART_PN % (index+1)}"
end
+ # The title object for the chart.
+ # @param [String, Cell] v
+ # @return [Title]
def title=(v)
v = Title.new(v) if v.is_a?(String) || v.is_a?(Cell)
DataTypeValidator.validate "#{self.class}.title", Title, v
@title = v
end
+ # Show the legend in the chart
+ # @param [Boolean] v
+ # @return [Boolean]
def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end
- def style=(v) DataTypeValidator.validate "Chart.style", Integer, v, lambda { |v| v >= 1 && v <= 48 }; @style = v; end
+
+ # The style for the chart.
+ # see ECMA Part 1 §21.2.2.196
+ # @param [Integer] v must be between 1 and 48
+ def style=(v) DataTypeValidator.validate "Chart.style", Integer, v, lambda { |arg| arg >= 1 && arg <= 48 }; @style = v; end
# backwards compatibility to allow chart.to and chart.from access to anchor markers
# @note This will be disconinued in version 2.0.0. Please use the end_at method