Sha256: d77adf2f22b22c981a8e4a02c62f8a18854b89b582ea09e4af371eb4d73b3d49

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

module ChartJS

  class Line 

    def initialize(container)
      @container = container
    end
    
    def build(&block)
      instance_eval(&block)
      @container 
    end

    def stepped(value = true)
      @container['steppedLine'] = case value
      when true # Step-before Interpolation -> eq "before"
        true
      when false # No Step Interpolation
        false
      when :before || "before"
        "before"
      when :after || "after"
        "after"
      else
        raise "Oops."
      end
    end
    
    def tension(value = 1)
      if value.is_a? Integer
        @container['lineTension'] = value
      elsif value == "flase" ||  value == :false
        @container['lineTension'] = 0
      else
        raise "Oops"
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chart_js-1.1.1 lib/chart_js/chart/dataset/line.rb
chart_js-1.1.0 lib/chart_js/chart/dataset/line.rb