Chartjs-The chart doesn't display the data from my call to the API with Axios

0👍

The problem is that axios.get makes an asynchronous HTTP request and assigns a value to the variable dataget only once it receives a response (inside the Promise.then() function). The chart however is created when the variable dataget is still undefined.

Move the entire code block located between the two comments // this is a test to the Promise.then() function just after the following code line and it should work.

dataget = response.data._size;

Leave a comment