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]: threshold table issue (#4247)

Rajat Dabade63efb2b25a18
diff --git a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
index 09e3ce4815..a86c1ee49c 100644
--- a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
+++ b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts
@@ -136,7 +136,18 @@ export const getUPlotChartOptions = ({
if (threshold.thresholdLabel) {
const text = threshold.thresholdLabel;
const textX = plotRight - ctx.measureText(text).width - 20;
- const textY = yPos - 15;
+
+ const canvasHeight = ctx.canvas.height;
+ const yposHeight = canvasHeight - yPos;
+ const isHeightGreaterThan90Percent = canvasHeight * 0.9 < yposHeight;
+
+ // Adjust textY based on the condition
+ let textY;
+ if (isHeightGreaterThan90Percent) {
+ textY = yPos + 15; // Below the threshold line
+ } else {
+ textY = yPos - 15; // Above the threshold line
+ }
ctx.fillStyle = threshold.thresholdColor || 'red';
ctx.fillText(text, textX, textY);
}