Class: Axlsx::DataBar
- Inherits:
-
Object
- Object
- Axlsx::DataBar
- Includes:
- OptionsParser, SerializedAttributes
- Defined in:
- lib/axlsx/workbook/worksheet/data_bar.rb
Overview
The recommended way to manage these rules is via Worksheet#add_conditional_formatting
Constant Summary collapse
- CHILD_ELEMENTS =
instance values that must be serialized as their own elements - e.g. not attributes.
[:value_objects, :color]
Instance Attribute Summary collapse
-
#max_length ⇒ Integer
(also: #maxLength)
maxLength attribute The maximum length of the data bar, as a percentage of the cell width.
-
#min_length ⇒ Integer
(also: #minLength)
minLength attribute The minimum length of the data bar, as a percentage of the cell width.
-
#show_value ⇒ Boolean
(also: #showValue)
maxLength attribute Indicates whether to show the values of the cells on which this data bar is applied.
Instance Method Summary collapse
-
#color ⇒ Color
color the color object used in the data bar formatting.
-
#color=(v) ⇒ Object
Sets the color for the data bars.
-
#initialize(options = {}) {|_self| ... } ⇒ DataBar
constructor
Creates a new data bar conditional formatting object.
-
#to_xml_string(str = "") ⇒ String
Serialize this object to an xml string.
-
#value_objects ⇒ SimpleTypedList
A simple typed list of cfvos.
Methods included from SerializedAttributes
included, #serialized_attributes
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ DataBar
Creates a new data bar conditional formatting object
18 19 20 21 22 23 24 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 18 def initialize( = {}) @min_length = 10 @max_length = 90 @show_value = true yield self if block_given? end |
Instance Attribute Details
#max_length ⇒ Integer Also known as: maxLength
maxLength attribute The maximum length of the data bar, as a percentage of the cell width. The default value is 90
42 43 44 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 42 def max_length @max_length end |
#min_length ⇒ Integer Also known as: minLength
minLength attribute The minimum length of the data bar, as a percentage of the cell width. The default value is 10
35 36 37 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 35 def min_length @min_length end |
#show_value ⇒ Boolean Also known as: showValue
maxLength attribute Indicates whether to show the values of the cells on which this data bar is applied. The default value is true
49 50 51 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 49 def show_value @show_value end |
Instance Method Details
#color ⇒ Color
color the color object used in the data bar formatting
62 63 64 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 62 def color @color ||= Color.new :rgb => "FF0000FF" end |
#color=(v) ⇒ Object
Sets the color for the data bars.
89 90 91 92 93 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 89 def color=(v) @color = v if v.is_a? Color self.color.rgb = v if v.is_a? String @color end |
#to_xml_string(str = "") ⇒ String
Serialize this object to an xml string
98 99 100 101 102 103 104 105 |
# File 'lib/axlsx/workbook/worksheet/data_bar.rb', line 98 def to_xml_string(str="") str << '<dataBar ' serialized_attributes str str << '>' value_objects.to_xml_string(str) self.color.to_xml_string(str) str << '</dataBar>' end |