Class: OoxmlParser::ChartAxis
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ChartAxis
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb
Overview
Parsing Chart axis tags ‘catAx’, ‘valAx’
Instance Attribute Summary collapse
-
#display ⇒ Object
Returns the value of attribute display.
-
#major_grid_lines ⇒ Object
Returns the value of attribute major_grid_lines.
-
#minor_grid_lines ⇒ Object
Returns the value of attribute minor_grid_lines.
-
#position ⇒ Object
Returns the value of attribute position.
-
#scaling ⇒ Scaling
readonly
Scaling attribute.
-
#tick_label_position ⇒ ValuedChild
readonly
The position of the tick labels.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ ChartAxis
constructor
A new instance of ChartAxis.
-
#parse(node) ⇒ ChartAxis
Parse ChartAxis object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(params = {}) ⇒ ChartAxis
Returns a new instance of ChartAxis.
14 15 16 17 18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 14 def initialize(params = {}) @title = params.fetch(:title, ChartAxisTitle.new) @display = params.fetch(:display, true) @minor_grid_lines = params.fetch(:minor_grid_lines, false) @major_grid_lines = params.fetch(:major_grid_lines, false) super(parent: params[:parent]) end |
Instance Attribute Details
#display ⇒ Object
Returns the value of attribute display.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 8 def display @display end |
#major_grid_lines ⇒ Object
Returns the value of attribute major_grid_lines.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 8 def major_grid_lines @major_grid_lines end |
#minor_grid_lines ⇒ Object
Returns the value of attribute minor_grid_lines.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 8 def minor_grid_lines @minor_grid_lines end |
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 8 def position @position end |
#scaling ⇒ Scaling (readonly)
Returns scaling attribute.
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 10 def scaling @scaling end |
#tick_label_position ⇒ ValuedChild (readonly)
Returns the position of the tick labels.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 12 def tick_label_position @tick_label_position end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 8 def title @title end |
Instance Method Details
#parse(node) ⇒ ChartAxis
Parse ChartAxis object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb', line 25 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'delete' @display = false if node_child.attribute('val').value == '1' when 'title' @title = ChartAxisTitle.new(parent: self).parse(node_child) when 'majorGridlines' @major_grid_lines = true when 'minorGridlines' @minor_grid_lines = true when 'scaling' @scaling = Scaling.new(parent: self).parse(node_child) when 'tickLblPos' @tick_label_position = ValuedChild.new(:symbol, parent: self).parse(node_child) when 'axPos' @position = value_to_symbol(node_child.attribute('val')) end end @display = false unless @title.visible? self end |