<script>
function randomInteger(min, max) {
var rand = min - 0.5 + Math.random() * (max - min + 1)
rand = Math.round(rand);
return rand;
}
function gameCounter (){
var a = [];
for (var s = 0; s < 10; s++){
a[s] = s+1;
}
return a;
};
function objectWithLine (nameTheory, massWinLoss){
function colorLine (){
var string1 = 'rgba(';
var string2 = ')';
var c1 = randomInteger(1, 255);
var c2 = randomInteger(1, 255);
var c3 = randomInteger(1, 255);
var c4 = randomInteger(1, 255);
var END = [];
return END[0] = string1 + c1 + ',' + c2 + ',' + c3 + ',' + c4 + string2;
};
var b = {
label: nameTheory,
data: massWinLoss,
borderColor:
colorLine(),
borderWidth: 1,
};
return b;
};
function massObjectWithLine(endCounter) {
var a = [];
for (var s = 0; s < endCounter; s++){
a[s] = objectWithLine(s, [randomInteger(1, 10), randomInteger(s, s+10), randomInteger(s-4, s+10), 15, randomInteger(s+15, s+30) ])
};
return a;
}
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: gameCounter(),
datasets: massObjectWithLine(300)
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
},
}
});
</script>