Sha256: 21b9023df50918e1f8cd23f07e477ceb2e390691b6427350a2b3356a46d252ba

Contents?: true

Size: 895 Bytes

Versions: 35

Compression:

Stored size: 895 Bytes

Contents

module ChartJS

  class PointHover 

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

    def radius(value)
      if value.is_a? Array
        @container['pointHoverRadius'] = value.map(&:to_i) 
      else
        @container['pointHoverRadius'] = value.to_i
      end
    end
    
    def width(value)
      if value.is_a? Array
        @container['pointHoverBorderWidth'] = value.map(&:to_i) 
      else
        @container['pointHoverBorderWidth'] = value.to_i
      end
    end

    def color(value, type = :both)
      case type 
      when :border
        @container['pointHoverBorderColor'] = value
      when :background
        @container['pointHoverBackgroundColor'] = value
      when :both
        color value, :borer
        color value, :background
      end
    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/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/radar_chart/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/radar_chart/dataset/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/line_chart/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/line_chart/dataset/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/dataset/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/bar_chart/point_hover.rb
chart_js-1.0.1pre lib/chart_js/chart/bar_chart/dataset/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/radar_chart/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/radar_chart/dataset/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/line_chart/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/line_chart/dataset/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/dataset/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/bar_chart/point_hover.rb
chart_js-1.0.0pre lib/chart_js/chart/bar_chart/dataset/point_hover.rb