Class: Axlsx::Axis
- Inherits:
-
Object
- Object
- Axlsx::Axis
- Defined in:
- lib/axlsx/drawing/axis.rb
Overview
the access class defines common properties and values for a chart axis.
Instance Attribute Summary (collapse)
-
- (Integer) axId
readonly
the id of the axis.
-
- (Symbol) axPos
The position of the axis must be one of [:l, :r, :t, :b].
-
- (Integer) crossAx
readonly
The perpendicular axis.
-
- (Symbol) crosses
specifies how the perpendicular axis is crossed must be one of [:autoZero, :min, :max].
-
- (String) format_code
The number format format code for this axis default :General.
-
- (Scaling) scaling
readonly
The scaling of the axis.
-
- (Symbol) tickLblPos
the position of the tick labels must be one of [:nextTo, :high, :low].
Instance Method Summary (collapse)
-
- (Axis) initialize(axId, crossAx, options = {})
constructor
Creates an Axis object.
-
- (String) to_xml(xml)
Serializes the common axis.
Constructor Details
- (Axis) initialize(axId, crossAx, options = {})
Creates an Axis object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/axlsx/drawing/axis.rb', line 45 def initialize(axId, crossAx, ={}) Axlsx::validate_unsigned_int(axId) Axlsx::validate_unsigned_int(crossAx) @axId = axId @crossAx = crossAx @scaling = Scaling.new(:orientation=>:minMax) self.axPos = :l self.tickLblPos = :nextTo self.format_code = "General" self.crosses = :autoZero .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
- (Integer) axId (readonly)
the id of the axis.
7 8 9 |
# File 'lib/axlsx/drawing/axis.rb', line 7 def axId @axId end |
- (Symbol) axPos
The position of the axis must be one of [:l, :r, :t, :b]
21 22 23 |
# File 'lib/axlsx/drawing/axis.rb', line 21 def axPos @axPos end |
- (Integer) crossAx (readonly)
The perpendicular axis
11 12 13 |
# File 'lib/axlsx/drawing/axis.rb', line 11 def crossAx @crossAx end |
- (Symbol) crosses
specifies how the perpendicular axis is crossed must be one of [:autoZero, :min, :max]
36 37 38 |
# File 'lib/axlsx/drawing/axis.rb', line 36 def crosses @crosses end |
- (String) format_code
The number format format code for this axis default :General
31 32 33 |
# File 'lib/axlsx/drawing/axis.rb', line 31 def format_code @format_code end |
- (Scaling) scaling (readonly)
The scaling of the axis
16 17 18 |
# File 'lib/axlsx/drawing/axis.rb', line 16 def scaling @scaling end |
- (Symbol) tickLblPos
the position of the tick labels must be one of [:nextTo, :high, :low]
26 27 28 |
# File 'lib/axlsx/drawing/axis.rb', line 26 def tickLblPos @tickLblPos end |
Instance Method Details
- (String) to_xml(xml)
Serializes the common axis
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/axlsx/drawing/axis.rb', line 68 def to_xml(xml) xml.send('c:axId', :val=>@axId) @scaling.to_xml(xml) xml.send('c:axPos', :val=>@axPos) xml.send('c:majorGridlines') xml.send('c:numFmt', :formatCode => @format_code, :sourceLinked=>"1") xml.send('c:tickLblPos', :val=>@tickLblPos) xml.send('c:crossAx', :val=>@crossAx) xml.send('c:crosses', :val=>@crosses) end |