Sha256: d312adf5abade37b2bae07beefe4817d8e938f47363a44e5e24a3ed8a60bd8be

Contents?: true

Size: 863 Bytes

Versions: 35

Compression:

Stored size: 863 Bytes

Contents

module ChartJS

  class Border 

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

    def color(value)
      @container['borderColor'] = value
    end
    
    def width(value)
      if value.is_a? Array
        @container['borderWidth'] = value.map(&:to_i) 
      else
        @container['borderWidth'] = value.to_i
      end
    end
    
    def dash(value)
      if value.is_a? Array
        @container['borderDash'] = value.map(&:to_i) 
      else
        raise "Dash must be an array!"
      end
    end
    
    def dash_offset(value)
      @container['borderDashOffset'] = value.to_i
    end

    def cap(value)
      @container['borderCapStyle'] = value
    end
    
    def join(value)
      @container['borderJoinStyle'] = value
    end
    
  end

end

Version data entries

35 entries across 5 versions & 1 rubygems

Version Path
chart_js-1.0.0 lib/chart_js/chart/radar_chart/dataset/border.rb
chart_js-1.0.1pre lib/chart_js/chart/radar_chart/dataset/border.rb
chart_js-1.0.1pre lib/chart_js/chart/radar_chart/border.rb
chart_js-1.0.1pre lib/chart_js/chart/line_chart/dataset/border.rb
chart_js-1.0.1pre lib/chart_js/chart/line_chart/border.rb
chart_js-1.0.1pre lib/chart_js/chart/dataset/border.rb
chart_js-1.0.1pre lib/chart_js/chart/bar_chart/dataset/border.rb
chart_js-1.0.1pre lib/chart_js/chart/bar_chart/border.rb
chart_js-1.0.0pre lib/chart_js/chart/radar_chart/dataset/border.rb
chart_js-1.0.0pre lib/chart_js/chart/radar_chart/border.rb
chart_js-1.0.0pre lib/chart_js/chart/line_chart/dataset/border.rb
chart_js-1.0.0pre lib/chart_js/chart/line_chart/border.rb
chart_js-1.0.0pre lib/chart_js/chart/dataset/border.rb
chart_js-1.0.0pre lib/chart_js/chart/bar_chart/dataset/border.rb
chart_js-1.0.0pre lib/chart_js/chart/bar_chart/border.rb