Class: Axlsx::LineChart
Overview
The LineChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet.
Direct Known Subclasses
Instance Attribute Summary collapse
Attributes inherited from Chart
#bg_color, #display_blanks_as, #graphic_frame, #legend_position, #series, #series_type, #show_legend, #style, #title, #vary_colors, #view_3D
Instance Method Summary collapse
-
#axes ⇒ Axes
The axes for this chart.
-
#cat_axis ⇒ CatAxis
(also: #catAxis)
the category axis.
-
#initialize(frame, options = {}) ⇒ LineChart
constructor
Creates a new line chart object.
-
#node_name ⇒ String
The node name to use in serialization.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
-
#val_axis ⇒ ValAxis
(also: #valAxis)
the category axis.
Methods inherited from Chart
#add_series, #d_lbls, #end_at, #from, #index, #pn, #relationship, #start_at, #to
Methods included from OptionsParser
Constructor Details
#initialize(frame, options = {}) ⇒ LineChart
Creates a new line chart object
48 49 50 51 52 53 54 |
# File 'lib/axlsx/drawing/line_chart.rb', line 48 def initialize(frame, ={}) @vary_colors = false @grouping = :standard super(frame, ) @series_type = LineSeries @d_lbls = nil end |
Instance Attribute Details
#grouping ⇒ Symbol
40 41 42 |
# File 'lib/axlsx/drawing/line_chart.rb', line 40 def grouping @grouping end |
Instance Method Details
#axes ⇒ Axes
The axes for this chart. LineCharts have a category and value axis.
95 96 97 |
# File 'lib/axlsx/drawing/line_chart.rb', line 95 def axes @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) end |
#cat_axis ⇒ CatAxis Also known as: catAxis
the category axis
26 27 28 |
# File 'lib/axlsx/drawing/line_chart.rb', line 26 def cat_axis axes[:cat_axis] end |
#node_name ⇒ String
The node name to use in serialization. As LineChart is used as the base class for Liine3DChart we need to be sure to serialize the chart based on the actual class type and not a fixed node name.
66 67 68 69 70 71 72 73 |
# File 'lib/axlsx/drawing/line_chart.rb', line 66 def node_name path = self.class.to_s if i = path.rindex('::') path = path[(i+2)..-1] end path[0] = path[0].chr.downcase path end |
#to_xml_string(str = '') ⇒ String
Serializes the object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/axlsx/drawing/line_chart.rb', line 78 def to_xml_string(str = '') super(str) do str << ("<c:" << node_name << ">") str << ('<c:grouping val="' << grouping.to_s << '"/>') str << ('<c:varyColors val="' << vary_colors.to_s << '"/>') @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls yield if block_given? axes.to_xml_string(str, :ids => true) str << ("</c:" << node_name << ">") axes.to_xml_string(str) end end |
#val_axis ⇒ ValAxis Also known as: valAxis
the category axis
33 34 35 |
# File 'lib/axlsx/drawing/line_chart.rb', line 33 def val_axis axes[:val_axis] end |