Comments (4)
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.
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.
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.
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)
- TypeError: Cannot read property 'length' of undefined HOT 6
- Getting {TypeError: Cannot read property 'confirmed' of undefined} when i my internet is disconnected. HOT 5
- To solution HOT 2
- Chart squashed in mobile view and cards are squashed for large screens(4k) HOT 4
- dailyData returned empty array HOT 3
- unhandled Rejection (TypeError): Cannot read property 'length' of undefined HOT 3
- xhr.js:184 GET http://localhost:3000/$%7Burl%7D/countries/$%7Bcountry%7D 404 (Not Found) HOT 3
- Problem when displaying the charts HOT 3
- size of chart is too small HOT 1
- Corona
- COVID Tracking Project has ended all data collection
- Api Not updating recovered data HOT 3
- A Solution if you encountered problems with Chart.js file
- Live site's date display is inverted
- data not showing HOT 1
- api not working HOT 4
- Website is breaking. HOT 3
- Deployment cannot be found is showing HOT 2
- My app HOT 1
- chart is not displaying api data. i am using this api : https://api.apify.com/v2/key-value-stores/toDWvRj1JpTXiM8FF/records/LATEST?disableRedirect=true HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from project_corona_tracker.