Class: RailsCharts::RadarChart

Inherits:
BaseChart show all
Defined in:
lib/rails_charts/radar_chart.rb

Constant Summary

Constants inherited from BaseChart

BaseChart::CHART_JS_PATTERN

Instance Attribute Summary

Attributes inherited from BaseChart

#chart_id, #container_id, #data, #debug, #height, #klass, #locale, #options, #other_options, #renderer, #style, #theme, #vertical, #width

Instance Method Summary collapse

Methods inherited from BaseChart

#axises, #initialize, #js_code, #option, #x_axis, #y_axis

Constructor Details

This class inherits a constructor from RailsCharts::BaseChart

Instance Method Details

#build_optionsObject



8
9
10
# File 'lib/rails_charts/radar_chart.rb', line 8

def build_options
  super.except(:xAxis, :yAxis).merge(radar)
end

#defaultsObject



27
28
29
30
31
32
33
34
35
# File 'lib/rails_charts/radar_chart.rb', line 27

def defaults
  {
    tooltip: {
      item: {
        trigger: 'item',
      },
    },
  }
end

#generate_series_optionsObject



20
21
22
23
24
25
# File 'lib/rails_charts/radar_chart.rb', line 20

def generate_series_options
  {
    type: type,
    data: data[:data]
  }
end

#radarObject



12
13
14
15
16
17
18
# File 'lib/rails_charts/radar_chart.rb', line 12

def radar
  {
    radar: {
      indicator: data[:indicators].map { |(k, v)| { name: k, max: v } }
    }
  }
end

#typeObject



4
5
6
# File 'lib/rails_charts/radar_chart.rb', line 4

def type
  'radar'
end