diff options
| author | Randy Morgan <[email protected]> | 2011-11-23 21:45:54 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-23 21:45:54 +0900 |
| commit | c8c63518b4d58ca8875f81602792050cbec318f2 (patch) | |
| tree | 14f6e2c5286e5509879b6b664205f3ea2f38180c /lib/axlsx/drawing/two_cell_anchor.rb | |
| parent | 2dea87f6f601795e32c7c14fbba5717c4b04fc1e (diff) | |
| download | caxlsx-c8c63518b4d58ca8875f81602792050cbec318f2.tar.gz caxlsx-c8c63518b4d58ca8875f81602792050cbec318f2.zip | |
Adding image support and some document clean up for .8 release
Diffstat (limited to 'lib/axlsx/drawing/two_cell_anchor.rb')
| -rw-r--r-- | lib/axlsx/drawing/two_cell_anchor.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb index 62491b8c..73e2fe20 100644 --- a/lib/axlsx/drawing/two_cell_anchor.rb +++ b/lib/axlsx/drawing/two_cell_anchor.rb @@ -12,8 +12,13 @@ module Axlsx attr_reader :to # The frame for your chart + # @note this will be discontinued in version 2.0 please use object # @return [GraphicFrame] - attr_reader :graphic_frame + # attr_reader :graphic_frame + + # The object this anchor hosts + # @return [Pic, GraphicFrame] + attr_reader :object # The drawing that holds this anchor # @return [Drawing] @@ -27,15 +32,23 @@ module Axlsx # graphic_frame's chart. That means that you can do stuff like # c = worksheet.add_chart Axlsx::Chart # c.start_at 5, 9 + # @note the chart_type parameter will be replaced with object in v. 2.0.0 # @param [Drawing] drawing # @param [Class] chart_type This is passed to the graphic frame for instantiation. must be Chart or a subclass of Chart + # @param object The object this anchor holds. # @option options [Array] start_at the col, row to start at # @option options [Array] end_at the col, row to end at - def initialize(drawing, chart_type, options) + def initialize(drawing, options={}) @drawing = drawing drawing.anchors << self @from, @to = Marker.new, Marker.new(:col => 5, :row=>10) - @graphic_frame = GraphicFrame.new(self, chart_type, options) + end + + # Creates a graphic frame and chart object associated with this anchor + # @return [Chart] + def add_chart(chart_type, options) + @object = GraphicFrame.new(self, chart_type, options) + @object.chart end def index @@ -53,7 +66,7 @@ module Axlsx xml.send('xdr:to') { to.to_xml(xml) } - @graphic_frame.to_xml(xml) + @object.to_xml(xml) xml.send('xdr:clientData') } end |
