Class: Axlsx::ScatterChart
- Includes:
- OptionsParser
- 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, #vary_colors, #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 included from OptionsParser
Methods inherited from Chart
#add_series, #d_lbls, #end_at, #from, #index, #pn, #relationship, #start_at, #to
Constructor Details
#initialize(frame, options = {}) ⇒ ScatterChart
Creates a new scatter chart
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 26 def initialize(frame, ={}) @vary_colors = 0 @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 end |
Instance Attribute Details
#scatterStyle ⇒ Object
The Style for the scatter chart must be one of :none | :line | :lineMarker | :marker | :smooth | :smoothMarker return [Symbol]
15 16 17 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 15 def scatterStyle @scatterStyle end |
#xValAxis ⇒ ValAxis (readonly)
the x value axis
19 20 21 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 19 def xValAxis @xValAxis end |
#yValAxis ⇒ ValAxis (readonly)
the y value axis
23 24 25 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 23 def yValAxis @yValAxis end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 48 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="' << vary_colors.to_s << '"/>' @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 |