Class: Axlsx::Marker

Inherits:
Object
  • Object
show all
Includes:
OptionsParser
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.

See Also:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from OptionsParser

#parse_options

Constructor Details

- (Marker) initialize(options = {})

Creates a new Marker object

Options Hash (options):

  • col (Integer)
  • colOff (Integer)
  • row (Integer)
  • rowOff (Integer)


15
16
17
18
# File 'lib/axlsx/drawing/marker.rb', line 15

def initialize(options={})
  @col, @colOff, @row, @rowOff = 0, 0, 0, 0
  parse_options options
end

Instance Attribute Details

- (Integer) col

The column this marker anchors to



22
23
24
# File 'lib/axlsx/drawing/marker.rb', line 22

def col
  @col
end

- (Integer) colOff

The offset distance from this marker's column



26
27
28
# File 'lib/axlsx/drawing/marker.rb', line 26

def colOff
  @colOff
end

- (Integer) row

The row this marker anchors to



30
31
32
# File 'lib/axlsx/drawing/marker.rb', line 30

def row
  @row
end

- (Integer) rowOff

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

- (Object) coord(col, row = 0)

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

- (String) to_xml_string(str = '')

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