I want to display multiple labels in the graph that is being displayed in my application.
In the library, you can see that the bar chart has a single label, "My First Dataset", being displayed at the top of the graph. I want another label with the next colour.
Here's my code:
this.chartData = {
labels: [
...labelList
],
datasets: [
{
label: ['Digital Revenue', 'Standard Revenue'], //I want these two at the top
data: [
...dataList
],
backgroundColor: [
'rgb(255, 99, 132)', //using these two colours, but I am getting both values with a single colour
'rgb(54, 162, 235)',
],
hoverOffset: 4,
},
],
};
this.chartConfig = {
type: CHART_CONFIG.BAR_CHART,
data: this.chartData,
options: {},
};
this.myChart = new Chart(
document.getElementById('myChart') as HTMLCanvasElement,
this.chartConfig
);