• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

97
Vistas
Remove specific label

Simple question, but can't seem to find the answer.

How can we remove a specific label on x-axis in chart.js?

This is the curve I currently have:enter image description here

Is there a way to simply hide the 9am while keep showing other label (10am.....)?

Things I tried:

ticks: {
                   
         callback: function(value, index, values) {
               return '';
            }
         }

But this will remove all the label on x-axis.

Any helps will be appreicated

Note: this is not a duplicate of Remove x-axis label/text in chart.js since I want to remove a specific x-label only.

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You always need to return something. So you can first check if the current label is 9am if so return an empty string otherwise return the label:

ticks: {
  callback: function(value, index, values) {
    const label = this.getLabelForValue(value)
    return label === '9am' ? '' : label;
  }
}
about 3 years ago · Juan Pablo Isaza Denunciar
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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda