Class: OoxmlParser::ChartLegend
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ChartLegend
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb
Overview
Legend of Chart legend tag
Instance Attribute Summary collapse
-
#overlay ⇒ Object
Returns the value of attribute overlay.
-
#position ⇒ Object
Returns the value of attribute position.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(position = :right, overlay = false, parent: nil) ⇒ ChartLegend
constructor
A new instance of ChartLegend.
-
#parse(node) ⇒ ChartLegend
Parse ChartLegend object.
-
#position_with_overlay ⇒ Symbol
Return combined data from @position and @overlay If there is no overlay - return :right f.e.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(position = :right, overlay = false, parent: nil) ⇒ ChartLegend
Returns a new instance of ChartLegend.
6 7 8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 6 def initialize(position = :right, = false, parent: nil) @position = position = @parent = parent end |
Instance Attribute Details
#overlay ⇒ Object
Returns the value of attribute overlay.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 4 def end |
#position ⇒ Object
Returns the value of attribute position.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 4 def position @position end |
Instance Method Details
#parse(node) ⇒ ChartLegend
Parse ChartLegend object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 26 def parse(node) node.xpath('*').each do |child_node| case child_node.name when 'legendPos' @position = value_to_symbol(child_node.attribute('val')) when 'overlay' = true if child_node.attribute('val').value.to_s == '1' end end self end |
#position_with_overlay ⇒ Symbol
Return combined data from @position and @overlay If there is no overlay - return :right f.e. If there is overlay - return :right_overlay
18 19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 18 def return "#{@position}_overlay".to_sym if @position end |