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
}
]