Class: OoxmlParser::ChartAxisTitle

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb

Overview

Chart Axis Title ‘title` node

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ ChartAxisTitle

Returns a new instance of ChartAxisTitle.



8
9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 8

def initialize(parent: nil)
  @elements = []
  super
end

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 6

def elements
  @elements
end

#layoutObject

Returns the value of attribute layout.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 6

def layout
  @layout
end

#overlayObject

Returns the value of attribute overlay.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 6

def overlay
  @overlay
end

Instance Method Details

#parse(node) ⇒ ChartAxisTitle

Parse ChartAxisTitle object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 21

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'tx'
      node_child.xpath('c:rich/*').each do |rich_node_child|
        case rich_node_child.name
        when 'p'
          root_object.default_font_style = FontStyle.new(true) # Default font style for chart title always bold
          @elements << Paragraph.new(parent: self).parse(rich_node_child)
          root_object.default_font_style = FontStyle.new
        end
      end
    when 'layout'
      @layout = option_enabled?(node_child)
    when 'overlay'
      @overlay = option_enabled?(node_child)
    end
  end
  self
end

#visible?Boolean

Returns if chart title is visible.

Returns:

  • (Boolean)

    if chart title is visible



14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 14

def visible?
  @layout || @overlay || !@elements.empty?
end