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

231
Vistas
Chartjs: Remove labels on the x-axis when all the values in dataset are zero in stacked bar chart

I am trying to remove the label entirely from the chart when all the values in the dataset are zero and it appears blank with labels as there is no point of showing it. Tried different ways but wasn't able to achieve it.

From the below screenshot I want just display "Wed, Fri and Mon" which have data and remove the rest.

enter image description here

For example: In the below data we have all zero's for Saturday and I do not want to show Sat on the chart with just empty/no stacked bar.

    const labels = [Mon, Tue, Wed, Thu, Fri, Sat, Sun] // Can be 7 days or 14 days
const data = {
  labels: labels,
  datasets: [
    {
      label: 'Dataset 1',
      data: [25,40,4,60,0,43],
      backgroundColor: red
    },
    {
      label: 'Dataset 2',
      data: [20,4,30,40,0,43],
      backgroundColor: blue
    },
    {
      label: 'Dataset 3',
      data: [2,4,4,100,0,43],
      backgroundColor: green
    },
  ]
};
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