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
15 16 17 18 |
# File 'lib/axlsx/drawing/marker.rb', line 15 def initialize(={}) @col, @colOff, @row, @rowOff = 0, 0, 0, 0 end |
Instance Attribute Details
#col ⇒ Integer
The column this marker anchors to
22 23 24 |
# File 'lib/axlsx/drawing/marker.rb', line 22 def col @col end |
#colOff ⇒ Integer
The offset distance from this marker's column
26 27 28 |
# File 'lib/axlsx/drawing/marker.rb', line 26 def colOff @colOff end |
#row ⇒ Integer
The row this marker anchors to
30 31 32 |
# File 'lib/axlsx/drawing/marker.rb', line 30 def row @row end |
#rowOff ⇒ Integer
The offset distance from this marker's row
34 35 36 |
# File 'lib/axlsx/drawing/marker.rb', line 34 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.
50 51 52 53 54 |
# File 'lib/axlsx/drawing/marker.rb', line 50 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
59 60 61 62 63 |
# File 'lib/axlsx/drawing/marker.rb', line 59 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 |