Sha256: 140533c1ba172a01045f07810fdc8f7f68d7123d84b1f26db456732cf83cd98f

Contents?: true

Size: 1.49 KB

Versions: 41

Compression:

Stored size: 1.49 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(params = {})
      @show_legend_key = params.fetch(:show_legend_key, false)
      @show_values = params.fetch(:show_values, false)
      super(parent: params[: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

41 entries across 41 versions & 1 rubygems

Version Path
ooxml_parser-0.38.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb