Sha256: 25495c043d0e130ab3f7c73dbc671e90e1eac19a187533bf8539ccbbcc9c2d7a

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Grafico
  module Helpers
    def graph_tag(graph_type, element, data, options = {})
      args = []
      args << data.to_json
      args << options.to_json unless options.empty?
      javascript_tag "var #{options[:variable_name] || (element + graph_type)} = new Grafico.#{graph_type}($('#{element}'), #{args.join});"
    end
    
    def line_graph_tag(element, data, options = {})
      graph_tag 'LineGraph', element, data, options
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grafico-0.1.1 lib/grafico/helpers.rb
grafico-0.1.0 lib/grafico/helpers.rb