Class: Axlsx::ScatterChart
- Defined in:
- lib/axlsx/drawing/scatter_chart.rb
Overview
The ScatterChart allows you to insert a scatter chart into your worksheet
Instance Attribute Summary collapse
-
#scatterStyle ⇒ Object
The Style for the scatter chart must be one of :none | :line | :lineMarker | :marker | :smooth | :smoothMarker return [Symbol].
-
#xValAxis ⇒ ValAxis
readonly
the x value axis.
-
#yValAxis ⇒ ValAxis
readonly
the y value axis.
Attributes inherited from Chart
#graphic_frame, #series, #series_type, #show_legend, #style, #title, #view_3D
Instance Method Summary collapse
-
#initialize(frame, options = {}) ⇒ ScatterChart
constructor
Creates a new scatter chart.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods inherited from Chart
#add_series, #d_lbls, #end_at, #from, #index, #pn, #start_at, #to
Constructor Details
#initialize(frame, options = {}) ⇒ ScatterChart
Creates a new scatter chart
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 24 def initialize(frame, ={}) @scatterStyle = :lineMarker @xValAxId = rand(8 ** 8) @yValAxId = rand(8 ** 8) @xValAxis = ValAxis.new(@xValAxId, @yValAxId) @yValAxis = ValAxis.new(@yValAxId, @xValAxId) super(frame, ) @series_type = ScatterSeries @d_lbls = nil .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#scatterStyle ⇒ Object
The Style for the scatter chart must be one of :none | :line | :lineMarker | :marker | :smooth | :smoothMarker return [Symbol]
13 14 15 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 13 def scatterStyle @scatterStyle end |
#xValAxis ⇒ ValAxis (readonly)
the x value axis
17 18 19 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 17 def xValAxis @xValAxis end |
#yValAxis ⇒ ValAxis (readonly)
the y value axis
21 22 23 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 21 def yValAxis @yValAxis end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 47 def to_xml_string(str = '') super(str) do |str_inner| str_inner << '<c:scatterChart>' str_inner << '<c:scatterStyle val="' << scatterStyle.to_s << '"/>' str_inner << '<c:varyColors val="1"/>' @series.each { |ser| ser.to_xml_string(str_inner) } d_lbls.to_xml_string(str) if @d_lbls str_inner << '<c:axId val="' << @xValAxId.to_s << '"/>' str_inner << '<c:axId val="' << @yValAxId.to_s << '"/>' str_inner << '</c:scatterChart>' @xValAxis.to_xml_string str_inner @yValAxis.to_xml_string str_inner end str end |