Class: ApexCharts::Charts::SyncingCharts

Inherits:
Object
  • Object
show all
Defined in:
lib/apex_charts/charts/syncing_charts.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SyncingCharts.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/apex_charts/charts/syncing_charts.rb', line 5

def initialize(outer_self, options={}, &block)
  @outer_self = outer_self
  @html = ''
  build_instance_variables
  @options = options
  @options[:group] ||= apexcharts_group

  instance_eval &block

  @options[:annotations] = @annotations if @annotations
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



64
65
66
67
68
69
70
# File 'lib/apex_charts/charts/syncing_charts.rb', line 64

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



24
25
26
27
28
29
# File 'lib/apex_charts/charts/syncing_charts.rb', line 24

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

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



31
32
33
34
35
36
# File 'lib/apex_charts/charts/syncing_charts.rb', line 31

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

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



38
39
40
41
42
43
# File 'lib/apex_charts/charts/syncing_charts.rb', line 38

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

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



17
18
19
20
21
22
# File 'lib/apex_charts/charts/syncing_charts.rb', line 17

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

#mixed_charts(options = {}, &block) ⇒ Object Also known as: combo_charts



52
53
54
55
56
57
# File 'lib/apex_charts/charts/syncing_charts.rb', line 52

def mixed_charts(options={}, &block)
  options[:id] = apexcharts_id
  outer_self = eval('self', block.binding, __FILE__, __LINE__)
  @html +=
    MixedCharts.new(outer_self, @options.merge(options), &block).render
end

#renderObject



60
61
62
# File 'lib/apex_charts/charts/syncing_charts.rb', line 60

def render
  @html
end

#respond_to_missing?(method, *args) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/apex_charts/charts/syncing_charts.rb', line 72

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

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



45
46
47
48
49
50
# File 'lib/apex_charts/charts/syncing_charts.rb', line 45

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