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)/
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 lables 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_id, #ax_pos, #color, #cross_ax, #crosses, #delete, #format_code, #gridlines, #label_rotation, #scaling, #tick_lbl_pos, #title
Instance Method Summary collapse
-
#initialize(ax_id, cross_ax, options = {}) ⇒ CatAxis
constructor
Creates a new CatAxis object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(ax_id, cross_ax, options = {}) ⇒ CatAxis
Creates a new CatAxis object
17 18 19 20 21 22 23 24 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 17 def initialize(ax_id, cross_ax, ={}) @tick_lbl_skip = 1 @tick_mark_skip = 1 self.auto = 1 self.lbl_algn = :ctr self.lbl_offset = "100" super(ax_id, cross_ax, ) 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.
28 29 30 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 28 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]
33 34 35 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 33 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
39 40 41 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 39 def lbl_offset @lbl_offset end |
#tick_lbl_skip ⇒ Integer Also known as: tickLblSkip
The number of tick lables to skip between labels
44 45 46 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 44 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.
49 50 51 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 49 def tick_mark_skip @tick_mark_skip end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/axlsx/drawing/cat_axis.rb', line 79 def to_xml_string(str = '') str << '<c:catAx>' super(str) 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 |