From 4d16bfc43780e5d3f7368625700b583e3e98217a Mon Sep 17 00:00:00 2001
From: Randy Morgan The recommended way to manage drawings and charts is Worksheet#add_chart.
-Anchors are specified by the :start_at and :end_at options to that method.
+The recommended way to manage drawings and charts is Worksheet#add_chart.
+Anchors are specified by the :start_at and :end_at options to that method.
+ This class details the anchor points for drawings.
+This class details the anchor points for drawings.
+
The drawing that holds this anchor.
++The drawing that holds this anchor. +
A marker that defines the from cell anchor.
++A marker that defines the from cell anchor. +
The object this anchor hosts.
++The object this anchor hosts. +
A marker that returns the to cell anchor.
++A marker that returns the to cell anchor. +
Creates a graphic frame and chart object associated with this anchor.
++Creates a graphic frame and chart object associated with this anchor. +
The index of this anchor in the drawing.
++The index of this anchor in the drawing. +
Creates a new TwoCellAnchor object and sets up a reference to the from and -to markers in the graphic_frame's chart.
++Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame’s chart. +
Serializes the two cell anchor.
++Serializes the two cell anchor. +
the chart_type parameter will be replaced with object in v. 2.0.0
++the chart_type parameter will be replaced with object in v. 2.0.0 +
Creates a new TwoCellAnchor object and sets up a reference to the from and -to markers in the graphic_frame's chart. That means that you can do stuff -like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9
++Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame’s chart. That means that you can do +stuff like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9 +
This is passed to the graphic frame for instantiation. must be Chart or a -subclass of Chart
++This is passed to the graphic frame for instantiation. must be Chart or a +subclass of Chart +
The object this anchor holds.
++The object this anchor holds. +
a customizable set of options
++a customizable set of options +
the col, row to start at
+ —+the col, row to start at +
the col, row to end at
+ —+the col, row to end at +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 38 -def initialize(drawing, ={}) - @drawing = drawing - drawing.anchors << self - @from, @to = Marker.new, Marker.new(:col => 5, :row=>10) -end+def initialize(drawing, ={}) + @drawing = drawing + drawing.anchors << self + @from, @to = Marker.new, Marker.new(:col => 5, :row=>10) +end +
The drawing that holds this anchor
++The drawing that holds this anchor +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 25 -def drawing - @drawing -end+def drawing + @drawing +end +
A marker that defines the from cell anchor. The default from column and row -are 0 and 0 respectively
++A marker that defines the from cell anchor. The default from column and row +are 0 and 0 respectively +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 9 -def from - @from -end+def from + @from +end +
The object this anchor hosts
++The object this anchor hosts +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 21 -def object - @object -end+def object + @object +end +
A marker that returns the to cell anchor. The default to column and row are -5 and 10 respectively
++A marker that returns the to cell anchor. The default to column and row are +5 and 10 respectively +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 12 -def to - @to -end+def to + @to +end +
Creates a graphic frame and chart object associated with this anchor
++Creates a graphic frame and chart object associated with this anchor +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 46 -def add_chart(chart_type, ) - @object = GraphicFrame.new(self, chart_type, ) - @object.chart -end+def add_chart(chart_type, ) + @object = GraphicFrame.new(self, chart_type, ) + @object.chart +end +
The index of this anchor in the drawing
++The index of this anchor in the drawing +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 53 -def index - @drawing.anchors.index(self) -end+def index + @drawing.anchors.index(self) +end +
Serializes the two cell anchor
++Serializes the two cell anchor +
The document builder instance this objects xml will be added to.
++The document builder instance this objects xml will be added to. +
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 59 -def to_xml(xml) - #build it for now, break it down later! - xml.send('xdr:twoCellAnchor') { - xml.send('xdr:from') { - from.to_xml(xml) - } - xml.send('xdr:to') { - to.to_xml(xml) - } - @object.to_xml(xml) - xml.send('xdr:clientData') - } -end+def to_xml(xml) + #build it for now, break it down later! + xml.send('xdr:twoCellAnchor') { + xml.send('xdr:from') { + from.to_xml(xml) + } + xml.send('xdr:to') { + to.to_xml(xml) + } + @object.to_xml(xml) + xml.send('xdr:clientData') + } +end +