Class: RCharts::GraphHelper::Series::Point

Inherits:
Struct
  • Object
show all
Defined in:
app/helpers/rcharts/graph_helper/series/point.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



7
8
9
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 7

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



7
8
9
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 7

def y
  @y
end

Instance Method Details

#+(other) ⇒ Object



10
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 10

def +(other) = Point.new(x + other.x, y + other.y)

#-(other) ⇒ Object



12
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 12

def -(other) = Point.new(x - other.x, y - other.y)

#complete?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 24

def complete?
  !incomplete?
end

#control(previous_point, next_point, smoothing: 1.0, reverse: false) ⇒ Object



14
15
16
17
18
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 14

def control(previous_point, next_point, smoothing: 1.0, reverse: false)
  (self + handle_offset(previous_point, next_point, smoothing:, reverse:)).then do |control|
    clamp(control, (reverse ? previous_point : next_point))
  end
end

#incomplete?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 20

def incomplete?
  x.nil? || y.nil?
end

#to_sObject



8
# File 'app/helpers/rcharts/graph_helper/series/point.rb', line 8

def to_s = "#{x},#{y}"