functionminValue(ctx){const dataset = ctx.chart.data.datasets[0];const min = dataset.data.reduce((max, point)=> Math.min(point, max),Infinity);returnisFinite(min)? min :0;}functionmaxValue(ctx){const datasets = ctx.chart.data.datasets;const count = datasets[0].data.length;let max =0;for(let i =0; i < count; i++){let sum =0;for(const dataset of datasets){
sum += dataset.data[i];}
max = Math.max(max, sum);}return max;}
constDATA_COUNT=8;constMIN=10;constMAX=100;
Utils.srand(8);const labels =[];for(let i =0; i <DATA_COUNT;++i){
labels.push(''+ i);}const numberCfg ={count:DATA_COUNT, min:MIN, max:MAX};const data ={
labels: labels,
datasets:[{
data: Utils.numbers(numberCfg)},{
data: Utils.numbers(numberCfg)},{
data: Utils.numbers(numberCfg)}]};