Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda