summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/chart.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-07-10 21:07:25 +0900
committerRandy Morgan <[email protected]>2012-07-10 21:07:25 +0900
commitc5f62d135f786917703d3dd9a98d66918d2ad1eb (patch)
tree75c4276b2a22640ac3cf7ed9ee20d10210a26c98 /lib/axlsx/drawing/chart.rb
parente82f217d5d94d5e07c195323b61f9e3195ac6634 (diff)
downloadcaxlsx-c5f62d135f786917703d3dd9a98d66918d2ad1eb.tar.gz
caxlsx-c5f62d135f786917703d3dd9a98d66918d2ad1eb.zip
more cleanup
Diffstat (limited to 'lib/axlsx/drawing/chart.rb')
-rw-r--r--lib/axlsx/drawing/chart.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb
index 5c8f5043..1f36dfe4 100644
--- a/lib/axlsx/drawing/chart.rb
+++ b/lib/axlsx/drawing/chart.rb
@@ -1,10 +1,33 @@
# encoding: UTF-8
module Axlsx
+
# A Chart is the superclass for specific charts
# @note Worksheet#add_chart is the recommended way to create charts for your worksheets.
# @see README for examples
class Chart
+ # Creates a new chart object
+ # @param [GraphicalFrame] frame The frame that holds this chart.
+ # @option options [Cell, String] title
+ # @option options [Boolean] show_legend
+ # @option options [Array|String|Cell] start_at The X, Y coordinates defining the top left corner of the chart.
+ # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart.
+ def initialize(frame, options={})
+ @style = 18
+ @view_3D = nil
+ @graphic_frame=frame
+ @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
+ @series = SimpleTypedList.new Series
+ @show_legend = true
+ @series_type = Series
+ @title = Title.new
+ 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[:end_at]
+ yield self if block_given?
+ end
# The 3D view properties for the chart
attr_reader :view_3D
@@ -38,29 +61,6 @@ module Axlsx
# @return [Boolean]
attr_reader :show_legend
- # Creates a new chart object
- # @param [GraphicalFrame] frame The frame that holds this chart.
- # @option options [Cell, String] title
- # @option options [Boolean] show_legend
- # @option options [Array|String|Cell] start_at The X, Y coordinates defining the top left corner of the chart.
- # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart.
- def initialize(frame, options={})
- @style = 18
- @view_3D = nil
- @graphic_frame=frame
- @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
- @series = SimpleTypedList.new Series
- @show_legend = true
- @series_type = Series
- @title = Title.new
- 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[:end_at]
- yield self if block_given?
- end
-
# The index of this chart in the workbooks charts collection
# @return [Integer]
def index
@@ -90,7 +90,6 @@ module Axlsx
# @return [Boolean]
def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end
-
# The style for the chart.
# see ECMA Part 1 ยง21.2.2.196
# @param [Integer] v must be between 1 and 48
@@ -198,4 +197,5 @@ module Axlsx
alias :view3D= :view_3D=
end
+
end