Module: D3Charts::ViewHelpers
- Defined in:
- lib/d3_charts/view_helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 |
# File 'lib/d3_charts/view_helpers.rb', line 7 def self.included(klass) klass.class_eval do include ActionView::Context end end |
Instance Method Details
#chart_tag(chart_type, chart_data, options = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/d3_charts/view_helpers.rb', line 13 def chart_tag(chart_type, chart_data, = {}) case chart_type when :pie then Chart::Pie.new(chart_data, ).tag.html_safe when :area then Chart::Area.new(chart_data, ).tag.html_safe end end |