Class: OoxmlParser::DisplayLabelsProperties

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(show_legend_key = false, show_values = false) ⇒ DisplayLabelsProperties

Returns a new instance of DisplayLabelsProperties.



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

def initialize(show_legend_key = false, show_values = false)
  @show_legend_key = show_legend_key
  @show_values = show_values
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_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_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

Class Method Details

.parse(display_labels_node) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb', line 11

def self.parse(display_labels_node)
  display_labels_properties = DisplayLabelsProperties.new
  display_labels_node.xpath('*').each do |display_label_property_node|
    case display_label_property_node.name
    when 'dLblPos'
      display_labels_properties.position = Alignment.parse(display_label_property_node.attribute('val'))
    when 'showLegendKey'
      display_labels_properties.show_legend_key = true if display_label_property_node.attribute('val').value == '1'
    when 'showVal'
      display_labels_properties.show_values = true if display_label_property_node.attribute('val').value == '1'
    end
  end
  display_labels_properties
end