Class: ChartJS::PointBorder

Inherits:
Object
  • Object
show all
Defined in:
lib/chart_js/chart/dataset/point_border.rb,
lib/chart_js/chart/bar_chart/point_border.rb,
lib/chart_js/chart/line_chart/point_border.rb,
lib/chart_js/chart/radar_chart/point_border.rb,
lib/chart_js/chart/bar_chart/dataset/point_border.rb,
lib/chart_js/chart/line_chart/dataset/point_border.rb,
lib/chart_js/chart/radar_chart/dataset/point_border.rb

Instance Method Summary collapse

Constructor Details

#initialize(container) ⇒ PointBorder

Returns a new instance of PointBorder.



5
6
7
# File 'lib/chart_js/chart/dataset/point_border.rb', line 5

def initialize(container)
  @container = container
end

Instance Method Details

#build(&block) ⇒ Object



9
10
11
12
# File 'lib/chart_js/chart/dataset/point_border.rb', line 9

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

#color(value, type = :both) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/chart_js/chart/dataset/point_border.rb', line 30

def color(value, type = :both)
  case type 
  when :hover
    @container['pointHoverBorderColor'] = value
  when :no_hover
    @container['pointBorderColor'] = value
  when :both
    color value, :hover
    color value, :no_hover
  end
end

#radius(value) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/chart_js/chart/dataset/point_border.rb', line 14

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

#width(value) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/chart_js/chart/dataset/point_border.rb', line 22

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