Class: ApexCharts::CartesianChart

Inherits:
BaseChart
  • Object
show all
Includes:
Annotations, Mixable, Utils::Hash
Defined in:
lib/apexcharts/charts/cartesian.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 Mixable

#mixed_series

Methods included from Annotations

#annotation, #point_annotation, #x_annotation, #y_annotation

Methods inherited from BaseChart

#chart_type, #render

Constructor Details

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

Returns a new instance of CartesianChart.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/apexcharts/charts/cartesian.rb', line 11

def initialize(outer_self, data, options={}, &block)
  @outer_self = outer_self
  options = deep_merge(
    camelize_keys(options),
    camelize_keys(more_options)
  )

  build_instance_variables if @outer_self

  instance_eval &block if block_given?

  options[:annotations] = @annotations if @annotations
  @series = build_series(data)
  @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



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

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

#more_optionsObject



33
34
35
# File 'lib/apexcharts/charts/cartesian.rb', line 33

def more_options
  {}
end

#respond_to_missing?(method, *args) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/apexcharts/charts/cartesian.rb', line 45

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

#series_typeObject



29
30
31
# File 'lib/apexcharts/charts/cartesian.rb', line 29

def series_type
  CartesianSeries
end