From fc5444f8b314fd1c5a3d691db7e51226c7f2faa0 Mon Sep 17 00:00:00 2001 From: Ollo Date: Fri, 17 Dec 2021 20:59:34 +0100 Subject: [PATCH] Multiple parameter in one diagram --- data/index.htm | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/data/index.htm b/data/index.htm index eb02e1a..50b376b 100644 --- a/data/index.htm +++ b/data/index.htm @@ -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 @@ - +