I have created this graph that simply shows the number of deaths against the days since the first death.
What I think would be interesting was to show the rate of change for each country but I'm struggling as to how to do this with the data.
An example of one country's data is below:
{
"gb": {
"data": [
// last 4 records
{
"x": 26,
"date": "31/03/2020",
"y": 1793,
"country": "GBR",
"delta": 382
},
{
"x": 27,
"date": "01/04/2020",
"y": 2357,
"country": "GBR",
"delta": 564
},
{
"x": 28,
"date": "02/04/2020",
"y": 2926,
"country": "GBR",
"delta": 569
},
{
"x": 29,
"date": "03/04/2020",
"y": 3611,
"country": "GBR",
"delta": 685
}
]
}
The delta is simply the difference from the day before.
I do remember from maths that the rate of change was dy/dx
.
My first step would be to get the equation of a curve given.
I know how to do the rest but how can I get the equation of a line given a set of coordinates in javascript?