module D3Charts::ViewHelpers

Public Class Methods

included(klass) click to toggle source
# File lib/d3_charts/view_helpers.rb, line 7
def self.included(klass)
  klass.class_eval do
    include ActionView::Context
  end
end

Public Instance Methods

chart_tag(chart_type, chart_data, options = {}) click to toggle source
# File lib/d3_charts/view_helpers.rb, line 13
def chart_tag(chart_type, chart_data, options = {})
  case chart_type
  when :pie then Chart::Pie.new(chart_data, options).tag.html_safe
  when :area then Chart::Area.new(chart_data, options).tag.html_safe
  end
end