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
-
#axId ⇒ Integer
readonly
the id of the axis.
-
#axPos ⇒ Symbol
The position of the axis must be one of [:l, :r, :t, :b].
-
#crossAx ⇒ Integer
readonly
The perpendicular axis.
-
#crosses ⇒ Symbol
specifies how the perpendicular axis is crossed must be one of [:autoZero, :min, :max].
-
#format_code ⇒ String
The number format format code for this axis default :General.
-
#scaling ⇒ Scaling
readonly
The scaling of the axis.
-
#tickLblPos ⇒ Symbol
the position of the tick labels must be one of [:nextTo, :high, :low].
Instance Method Summary collapse
-
#initialize(axId, crossAx, options = {}) ⇒ Axis
constructor
Creates an Axis object.
-
#to_xml(xml) ⇒ String
Serializes the common axis.
Constructor Details
permalink #initialize(axId, crossAx, options = {}) ⇒ Axis
Creates an Axis object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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 @format_code = "General" @scaling = Scaling.new(:orientation=>:minMax) self.axPos = :b 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
permalink #axId ⇒ Integer (readonly)
the id of the axis.
7 8 9 |
# File 'lib/axlsx/drawing/axis.rb', line 7 def axId @axId end |
permalink #axPos ⇒ Symbol
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 |
permalink #crossAx ⇒ Integer (readonly)
The perpendicular axis
11 12 13 |
# File 'lib/axlsx/drawing/axis.rb', line 11 def crossAx @crossAx end |
permalink #crosses ⇒ Symbol
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 |
permalink #format_code ⇒ String
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 |
permalink #scaling ⇒ Scaling (readonly)
The scaling of the axis
16 17 18 |
# File 'lib/axlsx/drawing/axis.rb', line 16 def scaling @scaling end |
permalink #tickLblPos ⇒ Symbol
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
permalink #to_xml(xml) ⇒ String
Serializes the common axis
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/axlsx/drawing/axis.rb', line 79 def to_xml(xml) xml.axId :val=>@axId @scaling.to_xml(xml) xml.delete :val=>0 xml.axPos :val=>@axPos xml.majorGridlines xml.numFmt :formatCode => @format_code, :sourceLinked=>"1" xml.majorTickMark :val=>"none" xml.minorTickMark :val=>"none" xml.tickLblPos :val=>@tickLblPos xml.crossAx :val=>@crossAx xml.crosses :val=>@crosses end |