Class: Montecasting::Charts

Inherits:
Object
  • Object
show all
Defined in:
lib/montecasting.rb

Overview

Charts class will contains all those methods to charts data, using rickshaw JS library it’s pretty straight forward.

Class Method Summary collapse

Class Method Details

.chart_cycle_time(array_of_time = [], round_to = 0.5) ⇒ Object



75
76
77
78
79
80
# File 'lib/montecasting.rb', line 75

def self.chart_cycle_time(array_of_time = [], round_to = 0.5)
  return nil unless array_of_time.all? Numeric
  ct_sorted = array_of_time.sort.map {|ct| ct.abs.to_f.round(round_to)}
  chart = Chart.new(ct_sorted)
  [chart.group_by, chart.cumulative]
end

.chart_montecarlo(array_of_time = [], backlog_items = 0, days_iteration = 0, rand_generator = 1000) ⇒ Object



70
71
72
73
# File 'lib/montecasting.rb', line 70

def self.chart_montecarlo(array_of_time = [], backlog_items = 0, days_iteration = 0, rand_generator = 1000)
  return nil unless array_of_time.all? Numeric
  chart_builder Forecasting.takt_times(array_of_time, rand_generator)&.map! {|elem| ((elem * backlog_items) / days_iteration).ceil(0)}
end

.chart_takt_times(array_of_time = []) ⇒ Object



65
66
67
68
# File 'lib/montecasting.rb', line 65

def self.chart_takt_times(array_of_time = [])
  return nil unless array_of_time.all? Numeric
  chart_builder Forecasting.takt_times(array_of_time)&.sort
end