class OoxmlParser::DataBar

Class for `dataBar` data

Attributes

axis_color[R]

@return [Color] Axis color

axis_position[R]

@return [Symbol] Position of axis in a cell

border[R]

@return [Symbol] Specifies whether data bar has border

border_color[R]

@return [Color] Border color for positive values

direction[R]

@return [Symbol] Data bar direction

fill_color[R]

@return [Color] Fill color for positive values

gradient[R]

@return [Symbol] Specifies whether data bar fill is gradient

max_length[R]

@return [Integer] Maximal length of the data bar as a percentage of the cell width

min_length[R]

@return [Integer] Minimal length of the data bar as a percentage of the cell width

negative_bar_same_as_positive[R]

@return [Symbol] Specifies whether fill color for negative values is same as for positive

negative_border_color[R]

@return [Color] Border color for negative values

negative_border_same_as_positive[R]

@return [Symbol] Specifies whether border color for negative values is same as for positive

negative_fill_color[R]

@return [Color] Fill color for negative values

show_value[R]

@return [Symbol] Specifies whether value is shown in a cell

values[R]

@return [Array, ConditionalFormatValueObject] minimal and maximal value

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb, line 38
def initialize(parent: nil)
  @values = []
  @show_value = true
  @gradient = true
  @negative_border_same_as_positive = true
  super
end

Public Instance Methods

maximum() click to toggle source

@return [ConditionalFormatValueObject] maximal value

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb, line 98
def maximum
  values[1]
end
minimum() click to toggle source

@return [ConditionalFormatValueObject] minimal value

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb, line 93
def minimum
  values[0]
end
parse(node) click to toggle source

Parse DataBar data @param [Nokogiri::XML:Element] node with DataBar data @return [DataBar] value of DataBar data

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb, line 49
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'minLength'
      @min_length = value.value.to_i
    when 'maxLength'
      @max_length = value.value.to_i
    when 'showValue'
      @show_value = attribute_enabled?(value)
    when 'axisPosition'
      @axis_position = value.value.to_sym
    when 'direction'
      @direction = value.value.to_sym
    when 'gradient'
      @gradient = attribute_enabled?(value)
    when 'border'
      @border = attribute_enabled?(value)
    when 'negativeBarColorSameAsPositive'
      @negative_bar_same_as_positive = attribute_enabled?(value)
    when 'negativeBarBorderColorSameAsPositive'
      @negative_border_same_as_positive = attribute_enabled?(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'cfvo'
      @values << ConditionalFormatValueObject.new(parent: self).parse(node_child)
    when 'fillColor'
      @fill_color = OoxmlColor.new(parent: self).parse(node_child)
    when 'negativeFillColor'
      @negative_fill_color = OoxmlColor.new(parent: self).parse(node_child)
    when 'borderColor'
      @border_color = OoxmlColor.new(parent: self).parse(node_child)
    when 'negativeBorderColor'
      @negative_border_color = OoxmlColor.new(parent: self).parse(node_child)
    when 'axisColor'
      @axis_color = OoxmlColor.new(parent: self).parse(node_child)
    end
  end
  self
end