Class: OoxmlParser::DisplayLabelsProperties

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

Overview

Chart Label Properties, parse tag ‘dLbls`

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(show_legend_key = false, show_values = false, parent: nil) ⇒ DisplayLabelsProperties

Returns a new instance of DisplayLabelsProperties.



10
11
12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 10

def initialize(show_legend_key = false, show_values = false, parent: nil)
  @show_legend_key = show_legend_key
  @show_values = show_values
  @parent = parent
end

Instance Attribute Details

#positionObject

Returns the value of attribute position.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 4

def position
  @position
end

#show_category_nameTrue, False

Returns is category name shown.

Returns:

  • (True, False)

    is category name shown



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

def show_category_name
  @show_category_name
end

#show_legend_keyObject

Returns the value of attribute show_legend_key.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 4

def show_legend_key
  @show_legend_key
end

#show_series_nameTrue, False

Returns is series name shown.

Returns:

  • (True, False)

    is series name shown



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

def show_series_name
  @show_series_name
end

#show_valuesObject

Returns the value of attribute show_values.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 4

def show_values
  @show_values
end

#show_x_axis_nameObject

Returns the value of attribute show_x_axis_name.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 4

def show_x_axis_name
  @show_x_axis_name
end

#show_y_axis_nameObject

Returns the value of attribute show_y_axis_name.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 4

def show_y_axis_name
  @show_y_axis_name
end

Instance Method Details

#parse(node) ⇒ DisplayLabelsProperties

Parse DisplayLabelsProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 19

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'dLblPos'
      @position = value_to_symbol(node_child.attribute('val'))
    when 'showLegendKey'
      @show_legend_key = true if node_child.attribute('val').value == '1'
    when 'showVal'
      @show_values = true if node_child.attribute('val').value == '1'
    when 'showCatName'
      @show_category_name = option_enabled?(node_child)
    when 'showSerName'
      @show_series_name = option_enabled?(node_child)
    end
  end
  self
end