Class: Axlsx::CatAxis
Overview
A CatAxis object defines a chart category axis
Constant Summary collapse
- LBL_OFFSET_REGEX =
regex for validating label offset
/0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)/.freeze
Instance Attribute Summary collapse
-
#auto ⇒ Boolean
From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
-
#lbl_algn ⇒ Symbol
(also: #lblAlgn)
specifies how the perpendicular axis is crossed must be one of [:ctr, :l, :r].
-
#lbl_offset ⇒ Integer
(also: #lblOffset)
The offset of the labels must be between a string between 0 and 1000.
-
#tick_lbl_skip ⇒ Integer
(also: #tickLblSkip)
The number of tick labels to skip between labels.
-
#tick_mark_skip ⇒ Boolean
(also: #tickMarkSkip)
The number of tickmarks to be skipped before the next one is rendered.
Attributes inherited from Axis
#ax_pos, #color, #cross_axis, #crosses, #delete, #format_code, #gridlines, #id, #label_rotation, #scaling, #tick_lbl_pos, #title
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CatAxis
constructor
Creates a new CatAxis object.
-
#to_xml_string(str = +'')) ⇒ String
Serializes the object.
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ CatAxis
Creates a new CatAxis object
9 10 11 12 13 14 15 16 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 9 def initialize( = {}) @tick_lbl_skip = 1 @tick_mark_skip = 1 self.auto = 1 self.lbl_algn = :ctr self.lbl_offset = "100" super end |
Instance Attribute Details
#auto ⇒ Boolean
From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
20 21 22 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 20 def auto @auto end |
#lbl_algn ⇒ Symbol Also known as: lblAlgn
specifies how the perpendicular axis is crossed must be one of [:ctr, :l, :r]
25 26 27 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 25 def lbl_algn @lbl_algn end |
#lbl_offset ⇒ Integer Also known as: lblOffset
The offset of the labels must be between a string between 0 and 1000
31 32 33 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 31 def lbl_offset @lbl_offset end |
#tick_lbl_skip ⇒ Integer Also known as: tickLblSkip
The number of tick labels to skip between labels
36 37 38 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 36 def tick_lbl_skip @tick_lbl_skip end |
#tick_mark_skip ⇒ Boolean Also known as: tickMarkSkip
The number of tickmarks to be skipped before the next one is rendered.
41 42 43 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 41 def tick_mark_skip @tick_mark_skip end |
Instance Method Details
#to_xml_string(str = +'')) ⇒ String
Serializes the object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 86 def to_xml_string(str = +'') str << '<c:catAx>' super str << '<c:auto val="' << @auto.to_s << '"/>' str << '<c:lblAlgn val="' << @lbl_algn.to_s << '"/>' str << '<c:lblOffset val="' << @lbl_offset.to_i.to_s << '"/>' str << '<c:tickLblSkip val="' << @tick_lbl_skip.to_s << '"/>' str << '<c:tickMarkSkip val="' << @tick_mark_skip.to_s << '"/>' str << '</c:catAx>' end |