lib/plasticine/helpers.rb in plasticine-1.1.1 vs lib/plasticine/helpers.rb in plasticine-1.2.0

- old
+ new

@@ -1,15 +1,19 @@ module Plasticine::Helpers def d3_include_tag - ('<![if ! lt IE 9]>' + javascript_include_tag("d3") + '<![endif]>').html_safe + javascript_include_tag("d3") end def column_visual(id, options={}) PlasticineTagHelper.new(self, id, options[:from], options[:to], options[:step]).column(options) end + def line_visual(id, options={}) + PlasticineTagHelper.new(self, id, options[:from], options[:to], options[:step]).line(options) + end + class PlasticineTagHelper attr_reader :rails_helpers delegate :content_tag, to: :rails_helpers delegate :link_to, to: :rails_helpers @@ -32,9 +36,22 @@ columns_margin: options.delete(:columns_margin), y_spacing_ratio: options.delete(:y_spacing_ratio) } visual 'column', options + end + + def line(options={}) + options.reverse_merge! lines_left_padding: 20, lines_right_padding: 20, lines_margin: 1, y_spacing_ratio: 1.10 + + options[:data] = { + lines_left_padding: options.delete(:lines_left_padding), + lines_right_padding: options.delete(:lines_right_padding), + lines_margin: options.delete(:lines_margin), + y_spacing_ratio: options.delete(:y_spacing_ratio) + } + + visual 'line', options end private