[Chartjs]-Vue-chartjs load data from parent component

4👍

Where does your data come from?
Your example code is weird, as you are not passing your data as props.

So no wonder, that nothing shows up.

You have to pass your datacollection to your chart component.

<chart :data="datacollection" />

And keep in mind, that if you are using an API your data will arrive async. So the component mounts, renders the chart but your data is not there. So you need to add a v-if to be sure that your api call is finished.

Leave a comment