Class: RailsCharts::DonutChart
- Defined in:
- lib/rails_charts/donut_chart.rb
Constant Summary
Constants inherited from BaseChart
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
- #defaults ⇒ Object
- #generate_series_options ⇒ Object
-
#initialize(data, options = {}) ⇒ DonutChart
constructor
A new instance of DonutChart.
Methods inherited from PieChart
#build_options, #type, #x_axis, #y_axis
Methods inherited from LineChart
#type, #x, #x_axis, #y, #y_axis
Methods inherited from BaseChart
#axises, #build_options, #js_code, #option, #x_axis, #y_axis
Constructor Details
#initialize(data, options = {}) ⇒ DonutChart
Returns a new instance of DonutChart.
4 5 6 |
# File 'lib/rails_charts/donut_chart.rb', line 4 def initialize(data, = {}) super(data, ) end |
Instance Method Details
#defaults ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_charts/donut_chart.rb', line 15 def defaults { tooltip: { item: { trigger: 'item', }, }, series: { radius: ['40%', '70%'] }, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } end |
#generate_series_options ⇒ Object
8 9 10 11 12 13 |
# File 'lib/rails_charts/donut_chart.rb', line 8 def { data: data.map{|k, v| {name: k, value: v} }, type: type } end |