Sha256: c4be20af885b7d17c5810f8895a52769d1c95ca466dcaff5fb663753e1aaf635
Contents?: true
Size: 572 Bytes
Versions: 3
Compression:
Stored size: 572 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 def sparkline_tag(element, data, options = {}) graph_tag 'SparkLine', element, data, options end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grafico-0.2.2 | lib/grafico/helpers.rb |
grafico-0.2.1 | lib/grafico/helpers.rb |
grafico-0.2.0 | lib/grafico/helpers.rb |