class Montecasting::Charts

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

Public Class Methods

chart_cycle_time(array_of_time = [], round_to = 0.5) click to toggle source
# 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) click to toggle source
# 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 = []) click to toggle source
# 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

Private Class Methods

chart_builder(chart_hash) click to toggle source
# File lib/montecasting.rb, line 84
def self.chart_builder chart_hash
  chart = Chart.new(chart_hash)
  [chart.group_by, chart.percent_of, chart.cumulative]
end