my plan is to display a temperature graph using chartJS that looks somewhat like the google one when you look up local weather. I am using data from openweathermap and would like to update the graph every 3 hours.
Unfortunatly I wasn't able to find a solution that worked for me to pass the data i get from openweathermaps to the chart array and update it.
In the documentation an update function is mentioned (http://www.chartjs.org/docs/latest/developers/updates.html) but I think I am too much of a bloody beginner to really understand how to apply it in this case.
This right here is the code I use to draw a chart with static numbers:
let myChart = document.getElementById('myChart').getContext('2d');
var WeatherChart = new Chart(myChart, {
type:'line',
data:{
labels:['3h', '6h', '9h', '12h',],
datasets:[{data:[12, 16, 16, 8],}]
},
options:{}
});
How would I go about using data from a variable or an array to update the chart?