2👍
HTML
<canvas id="chartOneContainer" width="600" height="400"></canvas>
<br />
<canvas id="chartTwoContainer" width="600" height="400"></canvas>
.
JAVASCRIPT
var optionsOne = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow"],
datasets: [
{
label: 'Colors One',
data: [7, 11, 5],
borderWidth: 1
}
]
},
options: {
scales: {
xAxes: [{
ticks: {
display: true
}
}]
}
}
}
var optionsTwo = {
type: 'line',
data: {
labels: ["Green", "Purple", "Orange"],
datasets: [
{
label: 'Colors Two',
data: [8, 3, 7],
borderWidth: 1
}
]
},
options: {
scales: {
xAxes: [{
ticks: {
display: true
}
}]
}
}
}
var ctxOne = document.getElementById('chartOneContainer').getContext('2d');
new Chart(ctxOne, optionsOne);
var ctxTwo = document.getElementById('chartTwoContainer').getContext('2d');
new Chart(ctxTwo, optionsTwo);
.
Example on JSFiddle
- Chartjs-How to use plugin in chartjs-node?
- Chartjs-How to manipulate with the y-axis values in chartjs
Source:stackexchange.com