Class: Axlsx::Marker
- Inherits:
-
Object
- Object
- Axlsx::Marker
- Includes:
- OptionsParser
- 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
-
#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 = 0) ⇒ Object
shortcut to set the column, row position for this marker or an Array.
-
#initialize(options = {}) ⇒ Marker
constructor
Creates a new Marker object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ Marker
Creates a new Marker object
13 14 15 16 |
# File 'lib/axlsx/drawing/marker.rb', line 13 def initialize( = {}) @col, @colOff, @row, @rowOff = 0, 0, 0, 0 end |
Instance Attribute Details
#col ⇒ Integer
The column this marker anchors to
20 21 22 |
# File 'lib/axlsx/drawing/marker.rb', line 20 def col @col end |
#colOff ⇒ Integer
The offset distance from this marker's column
24 25 26 |
# File 'lib/axlsx/drawing/marker.rb', line 24 def colOff @colOff end |
#row ⇒ Integer
The row this marker anchors to
28 29 30 |
# File 'lib/axlsx/drawing/marker.rb', line 28 def row @row end |
#rowOff ⇒ Integer
The offset distance from this marker's row
32 33 34 |
# File 'lib/axlsx/drawing/marker.rb', line 32 def rowOff @rowOff end |
Instance Method Details
#coord(col, row = 0) ⇒ Object
shortcut to set the column, row position for this marker or an Array. String or Array.
48 49 50 51 52 |
# File 'lib/axlsx/drawing/marker.rb', line 48 def coord(col, row = 0) coordinates = parse_coord_args(col, row) self.col = coordinates[0] self.row = coordinates[1] end |
#to_xml_string(str = '') ⇒ String
Serializes the object
57 58 59 60 61 |
# File 'lib/axlsx/drawing/marker.rb', line 57 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 |