Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add global data #4

Closed
jeetiss opened this issue Mar 16, 2020 · 2 comments
Closed

add global data #4

jeetiss opened this issue Mar 16, 2020 · 2 comments

Comments

@jeetiss
Copy link
Contributor

jeetiss commented Mar 16, 2020

Hello 🙌🏻

What do you think about adding global (total) data for all countries?
It will be helpful for my charts, but I not sure that count it every time is best idea.

@pomber
Copy link
Owner

pomber commented Mar 16, 2020

Hey. I prefer not to add it, it shouldn't be difficult to calculate it in the client.

For example, the global stats for the last day:

fetch("https://pomber.github.io/covid19/timeseries.json")
  .then(response => response.json())
  .then(data => {
    const countries = Object.keys(data)
    const global = { confirmed: 0, recovered: 0, deaths: 0 }
    countries.forEach(country => {
      const { confirmed, recovered, deaths } = data[country][
        data[country].length - 1
      ]
      global.confirmed += confirmed
      global.recovered += recovered
      global.deaths += deaths
    })
    console.log(global)
  })

@jeetiss
Copy link
Contributor Author

jeetiss commented Mar 17, 2020

Ок, thanks for response

@jeetiss jeetiss closed this as completed Mar 17, 2020
@pomber pomber mentioned this issue May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants