Can you guide me on how to display data using a loop?
Utilize (for; v-for) within: { labels: [] } and datasets: [{ data:[] }] when rendering a chart with Vue-Chart.js
I am seeking assistance for rendering data in the following structure:
data: {
labels: [
***FILL IN DATA HERE***
],
datasets: [{
label: "Assets",
backgroundColor: ["#4285F6"],
data: [
***FILL IN DATA HERE***
],
}],
},
The current format of my data includes an array with various objects inside:
LABELS:
this.array[0] ? this.array[0].asset.name : '',
this.array[0] ? this.array[1].asset.name : '',
this.array[0] ? this.array[2].asset.name : '',
DATASETS:
this.array[0] ? this.array[0].amount : '',
this.array[0] ? this.array[1].amount : '',
this.array[0] ? this.array[2].amount : '',