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

223
Vistas
Javascript - How to Remove Null Object in Chart JS

I need to remove an object with a null value from my dashboard, and I am not succeeding. I used the SkipNull function, and still my bar chart gets an empty blank space. Can you help me? Is there a way to do this?

My Chart:

this.chart = new Chart('canvas', {
          type: 'bar',
          data: {
            labels: this.serverName,
            datasets: [
              {
                data: this.serverMemory,
                borderColor: 'transparent',
                label: 'Full Memory',
                backgroundColor: '#007bff',
                borderWidth: 3,
                borderRadius: 10,
              },
              {
                data: this.serverMemoryUnused,
                borderColor: 'transparent',
                label: 'Memory Unused',
                backgroundColor: '#e3ebf6',
                borderWidth: 3,
                borderRadius: 10,
              },
            ],
          },

          options: {
            skipNull: true,
            scales: {
              x: {
                display: true,
              },
              y: {
                beginAtZero: true,
                ticks: {
                  callback: (label: any) => `${label * (1048576 / 1000000000)} GB`
                   
                },
                grid: {
                  display: false
                }
              },



            }
          }
        });

My payload:

[{
 memory: 10,
unused_memory: 20
},
{ memory: 10,
unused_memory: 20
},
{
memory: 10,
unused_memory: null
}
]

Result

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