Class: OoxmlParser::DataBar
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DataBar
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb
Overview
Class for ‘dataBar` data
Instance Attribute Summary collapse
-
#axis_color ⇒ Color
readonly
Axis color.
-
#axis_position ⇒ Symbol
readonly
Position of axis in a cell.
-
#border ⇒ Symbol
readonly
Specifies whether data bar has border.
-
#border_color ⇒ Color
readonly
Border color for positive values.
-
#direction ⇒ Symbol
readonly
Data bar direction.
-
#fill_color ⇒ Color
readonly
Fill color for positive values.
-
#gradient ⇒ Symbol
readonly
Specifies whether data bar fill is gradient.
-
#max_length ⇒ Integer
readonly
Maximal length of the data bar as a percentage of the cell width.
-
#min_length ⇒ Integer
readonly
Minimal length of the data bar as a percentage of the cell width.
-
#negative_bar_same_as_positive ⇒ Symbol
readonly
Specifies whether fill color for negative values is same as for positive.
-
#negative_border_color ⇒ Color
readonly
Border color for negative values.
-
#negative_border_same_as_positive ⇒ Symbol
readonly
Specifies whether border color for negative values is same as for positive.
-
#negative_fill_color ⇒ Color
readonly
Fill color for negative values.
-
#show_value ⇒ Symbol
readonly
Specifies whether value is shown in a cell.
-
#values ⇒ Array, ConditionalFormatValueObject
readonly
Minimal and maximal value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ DataBar
constructor
A new instance of DataBar.
-
#maximum ⇒ ConditionalFormatValueObject
Maximal value.
-
#minimum ⇒ ConditionalFormatValueObject
Minimal value.
-
#parse(node) ⇒ DataBar
Parse DataBar data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ DataBar
Returns a new instance of DataBar.
38 39 40 41 42 43 44 |
# File 'lib/ooxml_parser/xlsx_parser/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 |
Instance Attribute Details
#axis_color ⇒ Color (readonly)
Returns Axis color.
36 37 38 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 36 def axis_color @axis_color end |
#axis_position ⇒ Symbol (readonly)
Returns Position of axis in a cell.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 14 def axis_position @axis_position end |
#border ⇒ Symbol (readonly)
Returns Specifies whether data bar has border.
20 21 22 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 20 def border @border end |
#border_color ⇒ Color (readonly)
Returns Border color for positive values.
32 33 34 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 32 def border_color @border_color end |
#direction ⇒ Symbol (readonly)
Returns Data bar direction.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 16 def direction @direction end |
#fill_color ⇒ Color (readonly)
Returns Fill color for positive values.
28 29 30 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 28 def fill_color @fill_color end |
#gradient ⇒ Symbol (readonly)
Returns Specifies whether data bar fill is gradient.
18 19 20 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 18 def gradient @gradient end |
#max_length ⇒ Integer (readonly)
Returns Maximal length of the data bar as a percentage of the cell width.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 10 def max_length @max_length end |
#min_length ⇒ Integer (readonly)
Returns Minimal length of the data bar as a percentage of the cell width.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 8 def min_length @min_length end |
#negative_bar_same_as_positive ⇒ Symbol (readonly)
Returns Specifies whether fill color for negative values is same as for positive.
22 23 24 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 22 def @negative_bar_same_as_positive end |
#negative_border_color ⇒ Color (readonly)
Returns Border color for negative values.
34 35 36 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 34 def negative_border_color @negative_border_color end |
#negative_border_same_as_positive ⇒ Symbol (readonly)
Returns Specifies whether border color for negative values is same as for positive.
24 25 26 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 24 def negative_border_same_as_positive @negative_border_same_as_positive end |
#negative_fill_color ⇒ Color (readonly)
Returns Fill color for negative values.
30 31 32 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 30 def negative_fill_color @negative_fill_color end |
#show_value ⇒ Symbol (readonly)
Returns Specifies whether value is shown in a cell.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 12 def show_value @show_value end |
#values ⇒ Array, ConditionalFormatValueObject (readonly)
Returns minimal and maximal value.
26 27 28 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar.rb', line 26 def values @values end |
Instance Method Details
#maximum ⇒ ConditionalFormatValueObject
Returns maximal value.
98 99 100 |
# File 'lib/ooxml_parser/xlsx_parser/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 ⇒ ConditionalFormatValueObject
Returns minimal value.
93 94 95 |
# File 'lib/ooxml_parser/xlsx_parser/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) ⇒ DataBar
Parse DataBar data
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ooxml_parser/xlsx_parser/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 |