Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Display multiple labels using Chartjs

I want to display multiple labels in the graph that is being displayed in my application.

Link to Chartjs library

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
);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!