Class: OoxmlParser::Chart
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Chart
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb
Overview
Class for working with Chart data
Instance Attribute Summary collapse
-
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
-
#axis_ids ⇒ Array, ValuedChild
readonly
Array axis id.
-
#axises ⇒ Object
Returns the value of attribute axises.
-
#data ⇒ Object
Returns the value of attribute data.
-
#display_labels ⇒ Object
Returns the value of attribute display_labels.
-
#grouping ⇒ Object
Returns the value of attribute grouping.
-
#legend ⇒ Object
Returns the value of attribute legend.
-
#pivot_formats ⇒ PivotFormats
List of pivot formats.
-
#plot_area ⇒ PlotArea
Plot area data.
-
#relationships ⇒ Relationships
readonly
Relationships of chart.
-
#series ⇒ Array, Series
Series of chart.
-
#shape_properties ⇒ Object
Returns the value of attribute shape_properties.
-
#style ⇒ ChartStyle
readonly
Style of current chart.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#vary_colors ⇒ True, False
readonly
each data marker in the series has a different color.
-
#view_3d ⇒ View3D
Properties of 3D view.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ Chart
constructor
A new instance of Chart.
-
#parse ⇒ Chart
Parse Chart data.
-
#parse_properties(chart_prop_node) ⇒ void
Parse properties of Chart.
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) ⇒ Chart
Returns a new instance of Chart.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 37 def initialize(parent: nil) @axis_ids = [] @type = '' @data = [] @grouping = nil @title = nil @legend = nil @axises = [] @series = [] super end |
Instance Attribute Details
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def alternate_content @alternate_content end |
#axis_ids ⇒ Array, ValuedChild (readonly)
Returns array axis id.
19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 19 def axis_ids @axis_ids end |
#axises ⇒ Object
Returns the value of attribute axises.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def axises @axises end |
#data ⇒ Object
Returns the value of attribute data.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def data @data end |
#display_labels ⇒ Object
Returns the value of attribute display_labels.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def display_labels @display_labels end |
#grouping ⇒ Object
Returns the value of attribute grouping.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def grouping @grouping end |
#legend ⇒ Object
Returns the value of attribute legend.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def legend @legend end |
#pivot_formats ⇒ PivotFormats
Returns list of pivot formats.
23 24 25 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 23 def pivot_formats @pivot_formats end |
#plot_area ⇒ PlotArea
Returns plot area data.
25 26 27 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 25 def plot_area @plot_area end |
#relationships ⇒ Relationships (readonly)
Returns relationships of chart.
35 36 37 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 35 def relationships @relationships end |
#series ⇒ Array, Series
Returns series of chart.
21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 21 def series @series end |
#shape_properties ⇒ Object
Returns the value of attribute shape_properties.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def shape_properties @shape_properties end |
#style ⇒ ChartStyle (readonly)
Returns style of current chart.
33 34 35 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 33 def style @style end |
#title ⇒ Object
Returns the value of attribute title.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 17 def type @type end |
#vary_colors ⇒ True, False (readonly)
each data marker in the series has a different color. ECMA-376 (5th Edition). 21.2.2.227
29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 29 def vary_colors @vary_colors end |
#view_3d ⇒ View3D
Returns properties of 3D view.
31 32 33 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 31 def view_3d @view_3d end |
Instance Method Details
#parse ⇒ Chart
Parse Chart data
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 84 def parse chart_xml = parse_xml(root_object.current_xml) chart_xml.xpath('*').each do |chart_node| case chart_node.name when 'chartSpace' parse_chart_space(chart_node) end end parse_relationships parse_style self end |
#parse_properties(chart_prop_node) ⇒ void
This method returns an undefined value.
Parse properties of Chart
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 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb', line 52 def parse_properties(chart_prop_node) chart_prop_node.xpath('*').each do |chart_props_node_child| case chart_props_node_child.name when 'axId' @axis_ids << ValuedChild.new(:integer, parent: self).parse(chart_props_node_child) when 'grouping' @grouping = chart_props_node_child.attribute('val').value.to_sym when 'ser' @series << Series.new(parent: self).parse(chart_props_node_child) val = case @type when :point, :bubble chart_props_node_child.xpath('c:yVal')[0] else chart_props_node_child.xpath('c:val')[0] end next unless val next if val.xpath('c:numRef').empty? @data << ChartCellsRange.new(parent: self).parse(val.xpath('c:numRef').first) when 'dLbls' @display_labels = DisplayLabelsProperties.new(parent: self).parse(chart_props_node_child) when 'varyColors' @vary_colors = option_enabled?(chart_props_node_child) end end end |