Class: Axlsx::Marker
- Inherits:
-
Object
- Object
- Axlsx::Marker
- Defined in:
- lib/axlsx/drawing/marker.rb
Overview
The recommended way to manage markers is Worksheet#add_chart Markers are created for a two cell anchor based on the :start and :end options.
The Marker class defines a point in the worksheet that drawing anchors attach to.
Instance Attribute Summary (collapse)
-
- (Integer) col
The column this marker anchors to.
-
- (Integer) colOff
The offset distance from this marker’s column.
-
- (Integer) row
The row this marker anchors to.
-
- (Integer) rowOff
The offset distance from this marker’s row.
Instance Method Summary (collapse)
-
- (Object) coord(col, row)
shortcut to set the column, row position for this marker.
-
- (Marker) initialize(options = {})
constructor
Creates a new Marker object.
-
- (String) to_xml(xml)
Serializes the marker.
Constructor Details
- (Marker) initialize(options = {})
Creates a new Marker object
28 29 30 31 32 33 |
# File 'lib/axlsx/drawing/marker.rb', line 28 def initialize(={}) @col, @colOff, @row, @rowOff = 0, 0, 0, 0 .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end |
Instance Attribute Details
- (Integer) col
The column this marker anchors to
9 10 11 |
# File 'lib/axlsx/drawing/marker.rb', line 9 def col @col end |
- (Integer) colOff
The offset distance from this marker’s column
13 14 15 |
# File 'lib/axlsx/drawing/marker.rb', line 13 def colOff @colOff end |
- (Integer) row
The row this marker anchors to
17 18 19 |
# File 'lib/axlsx/drawing/marker.rb', line 17 def row @row end |
- (Integer) rowOff
The offset distance from this marker’s row
21 22 23 |
# File 'lib/axlsx/drawing/marker.rb', line 21 def rowOff @rowOff end |
Instance Method Details
- (Object) coord(col, row)
shortcut to set the column, row position for this marker
43 44 45 46 |
# File 'lib/axlsx/drawing/marker.rb', line 43 def coord(col, row) self.col = col self.row = row end |
- (String) to_xml(xml)
Serializes the marker
50 51 52 53 54 |
# File 'lib/axlsx/drawing/marker.rb', line 50 def to_xml(xml) [:col, :colOff, :row, :rowOff].each do |k| xml.send("xdr:#{k.to_s}", self.send(k)) end end |