1👍
The ChartJs labels are determined by the labels
property. In your example, this is set to an unknown variable called label
. This should be an array of strings.
For example:
labels: ['Italy', 'India', 'Japan', 'USA']
You could set this array to your label
variable, wherever it is defined:
const label = ['Italy', 'India', 'Japan', 'USA'];
{
...
labels: label
}
0👍
Template contain chart tag
<chartjs-pie :labels="labels" :data="dataset" :bind="true"></chartjs-pie>
Then pass data through script
data: function data() {
return {
labels: ['Italy', 'India', 'Japan', 'USA'],
dataset: [..]
};
},
Source:stackexchange.com