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

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(params = {}) ⇒ DisplayLabelsProperties

Returns a new instance of DisplayLabelsProperties.



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

def initialize(params = {})
  @show_legend_key = params.fetch(:show_legend_key, false)
  @show_values = params.fetch(:show_values, false)
  super(parent: params[:parent])
end

Instance Attribute Details

#deleteTrue, False (readonly)

Returns is label is deleted.

Returns:

  • (True, False)

    is label is deleted



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

def delete
  @delete
end

#positionObject

Returns the value of attribute position.



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

def position
  @position
end

#show_category_nameTrue, False

Returns is category name shown.

Returns:

  • (True, False)

    is category name shown



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

def show_category_name
  @show_category_name
end

#show_legend_keyObject

Returns the value of attribute show_legend_key.



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

def show_legend_key
  @show_legend_key
end

#show_series_nameTrue, False

Returns is series name shown.

Returns:

  • (True, False)

    is series name shown



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

def show_series_name
  @show_series_name
end

#show_valuesObject

Returns the value of attribute show_values.



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

def show_values
  @show_values
end

#show_x_axis_nameObject

Returns the value of attribute show_x_axis_name.



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

def show_x_axis_name
  @show_x_axis_name
end

#show_y_axis_nameObject

Returns the value of attribute show_y_axis_name.



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

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:



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

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)
    when 'delete'
      @delete = option_enabled?(node_child)
    end
  end
  self
end