var cfg = {
type: 'line',
data: {
labels: ['00:00', '01:35', '02:20', '03:05', '04:07', '04:57', '05:25', '06:08', '07:10'],
datasets: [{
data: [
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45),
randomScalingFactor(18, 45)
],
label: "Improved ETA",
borderColor: "#e67e22",
borderWidth: 2,
fill: false,
lineTension: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text: 'Improved ETA',
fontSize: 14,
fontFamily: 'Arial',
fontColor: '#000'
},
legend: {
display: false
},
scales: {
xAxes: [{
ticks: {
padding: 12
},
gridLines: {
color: 'rgba(0, 0, 0, 0.06)',
zeroLineColor: 'rgba(0, 0, 0, 0.06)',
drawTicks: false
}
}],
yAxes: [{
ticks: {
suggestedMin: 0,
suggestedMax: 80,
padding: 12
},
scaleLabel: {
display: true,
labelString: 'mins'
},
gridLines: {
color: 'rgba(0, 0, 0, 0.06)',
zeroLineColor: 'rgba(0, 0, 0, 0.06)',
drawTicks: false
}
}]
}
}
};
window.onload = function() {
var ctx = document.getElementById('foo').getContext('2d');
window.myLine = new Chart(ctx, cfg);
};
<div style="width: 600px; height: 400px;">
<canvas id="foo"></canvas>
</div>
See Question&Answers more detail:
os