Codice HTML:
<script
src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js">
</script>
<canvas id="chart1"></canvas>
<canvas id="chart2"></canvas>
<script>
const ctx1 = document.getElementById("chart1").getContext('2d');
const myChart1 = new Chart(ctx1, {
type: 'bar',
data: {
labels: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
datasets: [{
label: '12 15',
backgroundColor: 'rgba(161, 198, 247, 1)',
borderColor: 'rgb(47, 128, 237)',
data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31],
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
}
}]
}
},
});
const ctx2 = document.getElementById("chart2").getContext('2d');
const myChart2 = new Chart(ctx2, {
type: 'bar',
data: {
labels: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
datasets: [{
label: '12 15',
backgroundColor: 'rgba(161, 198, 247, 1)',
borderColor: 'rgb(47, 128, 237)',
data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31],
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
}
}]
}
},
});
</script>
Se non riesci, puoi indicare l'URL?