Multiple parameter in one diagram

This commit is contained in:
Ollo 2021-12-17 20:59:34 +01:00
parent 5955ca1a5c
commit fc5444f8b3

View File

@ -46,36 +46,26 @@
// Test chart
const ctx = document.getElementById('myChart');
dynamicData = {
labels: [ "0", "-30", "-60", "-90", "-120", "-160" ],
datasets: [{
label: 'temp',
data: [24, 22, 23, 25, 22, 23],
borderColor: "rgba(255,0,0,1)"
}, {
label: 'pressure',
data: [1000, 1002, 1003, 999, 996, 1000],
borderColor: "rgba(0,0,255,1)"
}
]
}
const myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
data: dynamicData,
options: {
scales: {
y: {
beginAtZero: true
beginAtZero: false
}
}
}
@ -127,6 +117,6 @@
</tr>
</tbody>
</table>
<canvas id="myChart" width="100%" height="400"></canvas>
<canvas id="myChart" width="100%" height="100"></canvas>
</body>
</html>