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, #view3D
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, #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 |
# 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 .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
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/axlsx/drawing/scatter_chart.rb', line 46 def to_xml_string(str = '') super do |str| str << '<c:scatterChart>' str << '<c:scatterStyle val="' << scatterStyle.to_s << '"/>' str << '<c:varyColors val="1"/>' @series.each { |ser| ser.to_xml_string(str) } str << '<c:dLbls>' str << '<c:showLegendKey val="0"/>' str << '<c:showVal val="0"/>' str << '<c:showCatName val="0"/>' str << '<c:showSerName val="0"/>' str << '<c:showPercent val="0"/>' str << '<c:showBubbleSize val="0"/>' str << '</c:dLbls>' str << '<c:axId val="' << @xValAxId.to_s << '"/>' str << '<c:axId val="' << @yValAxId.to_s << '"/>' str << '</c:scatterChart>' @xValAxis.to_xml_string str @yValAxis.to_xml_string str end str end |