UNPKG

cxviz-rawtree

Version:

Raw Tree Visualization

26 lines (21 loc) 563 B
function data () { var total = 10000 var max = 300 var min = 20 var typeRatio = 4 var fns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'] var previous = 0 var ret = [] while (previous <= total) { var datum = { start: previous, end: previous + Math.floor(Math.random()*(max-min+1)+min), type: Math.floor(Math.random()*typeRatio) ? 'work' : 'wait', fn: fns[Math.floor(Math.random()*fns.length)] } ret.push(datum) previous = datum.end } return ret } module.exports = data