Sha256: 43560fd341658ef8389f1accc0dd50c0940a35a9cd635fa3cd0856056cfa4e60

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Chart Label Properties, parse tag `dLbls`
  class DisplayLabelsProperties < OOXMLDocumentObject
    attr_accessor :position, :show_legend_key, :show_values, :show_x_axis_name, :show_y_axis_name
    # @return [True, False] is category name shown
    attr_accessor :show_category_name
    # @return [True, False] is series name shown
    attr_accessor :show_series_name
    # @return [True, False] is label is deleted
    attr_reader :delete

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

    # Parse DisplayLabelsProperties object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DisplayLabelsProperties] result of parsing
    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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.5.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.5.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb