Class: ApexCharts::MixedCharts

Inherits:
BaseChart show all
Includes:
Annotations, Utils::Hash
Defined in:
lib/apexcharts/charts/mixed.rb

Instance Attribute Summary

Attributes inherited from BaseChart

#options, #sample, #series

Instance Method Summary collapse

Methods included from Utils::Hash

camelize, camelize_keys, deep_merge

Methods included from Annotations

#annotation, #point_annotation, #x_annotation, #y_annotation

Methods inherited from BaseChart

#render

Constructor Details

#initialize(outer_self, options = {}, &block) ⇒ MixedCharts

Returns a new instance of MixedCharts.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/apexcharts/charts/mixed.rb', line 8

def initialize(outer_self, options={}, &block)
  @outer_self = outer_self
  @series = {series: []}
  options[:id] ||= apexcharts_id
  build_instance_variables

  instance_eval &block

  options[:annotations] = @annotations if @annotations
  @options = build_options(options)

  build_selection_range if brush?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/apexcharts/charts/mixed.rb', line 56

def method_missing(method, *args, &block)
  if @outer_self.respond_to?(method, true)
    @outer_self.send method, *args, &block
  else
    super
  end
end

Instance Method Details

#area_chart(data, options = {}, &block) ⇒ Object



32
33
34
35
36
# File 'lib/apexcharts/charts/mixed.rb', line 32

def area_chart(data, options={}, &block)
  outer_self = eval('self', block.binding, __FILE__, __LINE__) if block_given?
  @series[:series] +=
    AreaChart.new(outer_self, data, options, &block).mixed_series
end

#bar_chart(data, options = {}, &block) ⇒ Object



38
39
40
41
42
# File 'lib/apexcharts/charts/mixed.rb', line 38

def bar_chart(data, options={}, &block)
  outer_self = eval('self', block.binding, __FILE__, __LINE__) if block_given?
  @series[:series] +=
    BarChart.new(outer_self, data, options, &block).mixed_series
end

#chart_typeObject



22
23
24
# File 'lib/apexcharts/charts/mixed.rb', line 22

def chart_type
  'area' # chosen default
end

#column_chart(data, options = {}, &block) ⇒ Object



44
45
46
47
48
# File 'lib/apexcharts/charts/mixed.rb', line 44

def column_chart(data, options={}, &block)
  outer_self = eval('self', block.binding, __FILE__, __LINE__) if block_given?
  @series[:series] +=
    ColumnChart.new(outer_self, data, options, &block).mixed_series
end

#line_chart(data, options = {}, &block) ⇒ Object



26
27
28
29
30
# File 'lib/apexcharts/charts/mixed.rb', line 26

def line_chart(data, options={}, &block)
  outer_self = eval('self', block.binding, __FILE__, __LINE__) if block_given?
  @series[:series] +=
    LineChart.new(outer_self, data, options, &block).mixed_series
end

#respond_to_missing?(method, *args) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/apexcharts/charts/mixed.rb', line 64

def respond_to_missing?(method, *args)
  @outer_self.respond_to?(method, true) || super
end

#scatter_chart(data, options = {}, &block) ⇒ Object



50
51
52
53
54
# File 'lib/apexcharts/charts/mixed.rb', line 50

def scatter_chart(data, options={}, &block)
  outer_self = eval('self', block.binding, __FILE__, __LINE__) if block_given?
  @series[:series] +=
    ScatterChart.new(outer_self, data, options, &block).mixed_series
end