context.dataset.data[context.dataIndex].label; // labels in each data object
context.dataset.labels[context.dataIndex]; // labels store in the dataset
globalLabels[context.dataIndex]; // labels store outside the chart
seem to be rather useless here. They were undefined except for the first one.
By setting a breakpoint I discovered that my dataset had in fact one label:
context.dataset.label
Maybe add more example values or document the context type.
I guess the values depend on which values your dataset has (for example not all datasets have a 'stack' member).
Hi, I am using this plugin to show the labels of the datasets inside the bars. Hence, I customize the formatter. The example values from the documentation (https://v2_1_0--chartjs-plugin-datalabels.netlify.app/guide/formatting.html#custom-labels):
seem to be rather useless here. They were undefined except for the first one. By setting a breakpoint I discovered that my dataset had in fact one label:
Maybe add more example values or document the context type. I guess the values depend on which values your dataset has (for example not all datasets have a 'stack' member).