Class: ApexCharts::Series::BubbleSeries

Inherits:
Object
  • Object
show all
Includes:
Utils::Copy
Defined in:
lib/apex_charts/series/bubble_series.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Copy

#deep_copy

Constructor Details

#initialize(data) ⇒ BubbleSeries

Returns a new instance of BubbleSeries.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/apex_charts/series/bubble_series.rb', line 11

def initialize(data)
  data = deep_copy(data)
  sanitized =
    case data
    when Array
      if array_of_threes?(data)
        [{data: data}]
      else
        data
      end

    when Hash
      if data_value = data[:data]
        [data] if array_of_threes?(data_value)
      end

    end

  @sanitized = {series: sanitized}
end

Instance Attribute Details

#sanitizedObject (readonly)

Returns the value of attribute sanitized.



9
10
11
# File 'lib/apex_charts/series/bubble_series.rb', line 9

def sanitized
  @sanitized
end

Instance Method Details

#sampleObject



32
33
34
35
36
# File 'lib/apex_charts/series/bubble_series.rb', line 32

def sample
  return if empty?

  sanitized[:series][0][:data][0]
end