Class: Axlsx::ScatterChart

Inherits:
Chart
  • Object
show all
Includes:
OptionsParser
Defined in:
lib/axlsx/drawing/scatter_chart.rb

Overview

The ScatterChart allows you to insert a scatter chart into your worksheet

See Also:

Instance Attribute Summary collapse

Attributes inherited from Chart

#display_blanks_as, #graphic_frame, #series, #series_type, #show_legend, #style, #title, #vary_colors, #view_3D

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

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



33
34
35
36
37
38
39
40
41
# File 'lib/axlsx/drawing/scatter_chart.rb', line 33

def initialize(frame, options={})
  @vary_colors = 0
  @scatter_style = :lineMarker

       super(frame, options)
  @series_type = ScatterSeries
  @d_lbls = nil
  parse_options options
end

Instance Attribute Details

#scatter_styleObject Also known as: scatterStyle

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 scatter_style
  @scatter_style
end

Instance Method Details

#axesAxes

The axes for the scatter chart. ScatterChart has an x_val_axis and a y_val_axis

Returns:



70
71
72
# File 'lib/axlsx/drawing/scatter_chart.rb', line 70

def axes
  @axes ||= Axes.new(:x_val_axis => ValAxis, :y_val_axis => ValAxis)
end

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/axlsx/drawing/scatter_chart.rb', line 53

def to_xml_string(str = '')
  super(str) do |str_inner|
    str_inner << '<c:scatterChart>'
    str_inner << '<c:scatterStyle val="' << scatter_style.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_inner) if @d_lbls
    axes.to_xml_string(str_inner, :ids => true)
    str_inner << '</c:scatterChart>'
    axes.to_xml_string(str_inner)
  end
  str
end

#x_val_axisValAxis Also known as: xValAxis

the x value axis

Returns:



20
21
22
# File 'lib/axlsx/drawing/scatter_chart.rb', line 20

def x_val_axis
  axes[:x_val_axis]
end

#y_val_axisValAxis Also known as: yValAxis

the y value axis

Returns:



27
28
29
# File 'lib/axlsx/drawing/scatter_chart.rb', line 27

def y_val_axis
  axes[:x_val_axis]
end