Class: Axlsx::BubbleSeries

Inherits:
Series
  • Object
show all
Defined in:
lib/axlsx/drawing/bubble_series.rb

Overview

Note:

The recommended way to manage series is to use Chart#add_series

A BubbleSeries defines the x/y position and bubble size of data in the chart

See Also:

Instance Attribute Summary collapse

Attributes inherited from Series

#chart, #title

Instance Method Summary collapse

Methods inherited from Series

#index, #order, #order=

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(chart, options = {}) ⇒ BubbleSeries

Creates a new BubbleSeries



26
27
28
29
30
31
32
# File 'lib/axlsx/drawing/bubble_series.rb', line 26

def initialize(chart, options = {})
  @xData, @yData, @bubbleSize = nil
  super(chart, options)
  @xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil?
  @yData = NumDataSource.new({ :tag_name => :yVal, :data => options[:yData] }) unless options[:yData].nil?
  @bubbleSize = NumDataSource.new({ :tag_name => :bubbleSize, :data => options[:bubbleSize] }) unless options[:bubbleSize].nil?
end

Instance Attribute Details

#bubbleSizeNumDataSource (readonly)

The bubble size for this series.

Returns:



18
19
20
# File 'lib/axlsx/drawing/bubble_series.rb', line 18

def bubbleSize
  @bubbleSize
end

#colorString

The fill color for this series. Red, green, and blue is expressed as sequence of hex digits, RRGGBB. A perceptual gamma of 2.2 is used.

Returns:

  • (String)


23
24
25
# File 'lib/axlsx/drawing/bubble_series.rb', line 23

def color
  @color
end

#xDataAxDataSource (readonly)

The x data for this series.

Returns:



10
11
12
# File 'lib/axlsx/drawing/bubble_series.rb', line 10

def xData
  @xData
end

#yDataNumDataSource (readonly)

The y data for this series.

Returns:



14
15
16
# File 'lib/axlsx/drawing/bubble_series.rb', line 14

def yData
  @yData
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

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

Returns:

  • (String)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/axlsx/drawing/bubble_series.rb', line 42

def to_xml_string(str = '')
  super(str) do
    # needs to override the super color here to push in ln/and something else!
    if color
      str << '<c:spPr><a:solidFill>'
      str << ('<a:srgbClr val="' << color << '"/>')
      str << '</a:solidFill>'
      str << '<a:ln><a:solidFill>'
      str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
      str << '</c:spPr>'
    end
    @xData.to_xml_string(str) unless @xData.nil?
    @yData.to_xml_string(str) unless @yData.nil?
    @bubbleSize.to_xml_string(str) unless @bubbleSize.nil?
  end
  str
end