Giter VIP home page Giter VIP logo

Comments (4)

imelendez avatar imelendez commented on June 2, 2024

On index.js, in your try {}
Isn't the API /v2/historical/all

Is it missing the v2?

What does the console.log display on your console? That should help, is it udnefined, or show something else.

from project_corona_tracker.

kortstin avatar kortstin commented on June 2, 2024

Oh no it has the v2 in the base url. The console log displays an object of objects of cases(infected), deaths, and recovered. I wanted to keep it as close to yours as possible.

API response looks like:

{ cases:{ key:value}, deaths:{ key: value}, etc....
The keys are dates and the values are the numbers on that dates.

Would you be able to help me transfer data to the chart keeping the structure as close to yours as possible?

from project_corona_tracker.

imelendez avatar imelendez commented on June 2, 2024

Have you tried using the filter method to filter the current date from the object list you get back?

Or you can just 'pop off', use the latest value in the corresponding object lists {"date": value}

Notice in the original tutorial the API responded back with one value for confirmed, recovered, deaths.

The API you're using brings back the counts for the last 30 days or whatever query of last days put in.

Resource: MDN web doc Array.prototype.filter()

from project_corona_tracker.

kortstin avatar kortstin commented on June 2, 2024

Hey I was actually able to separate the keys and assign them to a label constant, and do the same for cases, recovered, and deaths assigning them to variables too? I have updated the code above. Can you help me with moving these variables over to Chart.jsx?

from project_corona_tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.