Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: added null checks for stacked bar chart with fallbacks (#5282)

Vikrant Guptac0195e9dc90f
diff --git a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
index daf21e1429..dd08cbfff1 100644
--- a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
+++ b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
@@ -68,7 +68,8 @@ function getStackedSeries(apiResponse: QueryData[]): QueryData[] {
const { values } = series[i];
for (let j = 0; j < values.length; j++) {
values[j][1] = String(
- parseFloat(values[j]?.[1]) + parseFloat(series[i + 1].values[j]?.[1]),
+ parseFloat(values[j]?.[1] || '0') +
+ parseFloat(series[i + 1].values[j]?.[1] || '0'),
);
}
@@ -88,7 +89,8 @@ function getStackedSeriesQueryFormat(apiResponse: QueryData[]): QueryData[] {
const { values } = series[i];
for (let j = 0; j < values.length; j++) {
values[j].value = String(
- parseFloat(values[j].value) + parseFloat(series[i + 1].values[j].value),
+ parseFloat(values[j]?.value || '0') +
+ parseFloat(series[i + 1].values[j]?.value || '0'),
);
}