Module: Reputation::Functions::Mixin

Included in:
GeneralisedLogisticCurve, Linear, Step
Defined in:
lib/reputation/functions/mixin.rb

Instance Method Summary collapse

Instance Method Details

#google_chartObject

Opens the google chart for the function in the browser



25
26
27
# File 'lib/reputation/functions/mixin.rb', line 25

def google_chart
  Launchy::Browser.run google_chart_url
end

#google_chart_urlObject

Produces the URL for a google chart of the function



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/reputation/functions/mixin.rb', line 10

def google_chart_url
  points = 1000
  range = Array.new(points){|i| (i-points/2) * 0.01 }
  y = range.map{|x| f(x) }
  c = Googlecharts.line(
    :size => '800x200',
    :axis_with_labels => 'x,y',
    :title => self.class.name,
    :data => y,
    :axis_range => [[range.first,range.last],[y.min,y.max]]
  )
end