ChartJS Line Chart
Multiple Line Chart
by simonbrunel
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.js"></script>
<body>
<canvas id="chart" width="600" height="400"></canvas>
</body>
CSS
canvas {
background-color: #eee;
}
JavaScript
Chart.helpers.merge(Chart.defaults.scale, {
categoryPercentage: 0.8,
barPercentage: 0.8,
offset: true
});
new Chart('chart', {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
type: 'line',
label: 'line',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
}, {
type: 'bubble',
label: 'bubble',
data: [{
x: 'Red',
y: 4
}, {
x: 'Red',
y: 8
}, {
x: 'Yellow',
y: 7
}],
backgroundColor: '#aacc55',
borderWidth: 1,
showLine: false,
radius: 10
}, {
type: 'scatter',
label: 'scatter',
data: [7, 11, 5, 8, 3, 7],
pointBackgroundColor: 'blue',
borderWidth: 1,
showLine: false
}, {
type: 'bar',
label: 'bar',
data: [5, 20, 10, 9, 4, 8],
backgroundColor: '#80aaff',
borderWidth: 1,
showLine: false
}]
}
});