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(params = {}) ⇒ 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
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(params = {}) ⇒ ChartLegend
Returns a new instance of ChartLegend.
8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 8 def initialize(params = {}) @position = params.fetch(:position, :right) @overlay = params.fetch(:overlay, false) super(parent: params[:parent]) end |
Instance Attribute Details
#overlay ⇒ Object
Returns the value of attribute overlay.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 6 def @overlay end |
#position ⇒ Object
Returns the value of attribute position.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 6 def position @position end |
Instance Method Details
#parse(node) ⇒ ChartLegend
Parse ChartLegend object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb', line 27 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' @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 22 |
# 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 |