Class: Axlsx::Marker
- Inherits:
-
Object
- Object
- Axlsx::Marker
- Defined in:
- lib/axlsx/drawing/marker.rb
Overview
Note:
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
-
#col ⇒ Integer
The column this marker anchors to.
-
#colOff ⇒ Integer
The offset distance from this marker's column.
-
#row ⇒ Integer
The row this marker anchors to.
-
#rowOff ⇒ Integer
The offset distance from this marker's row.
Instance Method Summary collapse
-
#coord(col, row) ⇒ Object
shortcut to set the column, row position for this marker.
-
#initialize(options = {}) ⇒ Marker
constructor
Creates a new Marker object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ Marker
Creates a new Marker object
29 30 31 32 33 34 |
# File 'lib/axlsx/drawing/marker.rb', line 29 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
#col ⇒ Integer
The column this marker anchors to
10 11 12 |
# File 'lib/axlsx/drawing/marker.rb', line 10 def col @col end |
#colOff ⇒ Integer
The offset distance from this marker's column
14 15 16 |
# File 'lib/axlsx/drawing/marker.rb', line 14 def colOff @colOff end |
#row ⇒ Integer
The row this marker anchors to
18 19 20 |
# File 'lib/axlsx/drawing/marker.rb', line 18 def row @row end |
#rowOff ⇒ Integer
The offset distance from this marker's row
22 23 24 |
# File 'lib/axlsx/drawing/marker.rb', line 22 def rowOff @rowOff end |
Instance Method Details
#coord(col, row) ⇒ Object
shortcut to set the column, row position for this marker
48 49 50 51 |
# File 'lib/axlsx/drawing/marker.rb', line 48 def coord(col, row) self.col = col self.row = row end |
#to_xml_string(str = '') ⇒ String
Serializes the object
56 57 58 59 60 |
# File 'lib/axlsx/drawing/marker.rb', line 56 def to_xml_string(str = '') [:col, :colOff, :row, :rowOff].each do |k| str << '<xdr:' << k.to_s << '>' << self.send(k).to_s << '</xdr:' << k.to_s << '>' end end |