mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 01:39:01 +08:00
[Fix]: threshold table issue (#4247)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
788a38d39c
commit
63efb2b25a
@ -136,7 +136,18 @@ export const getUPlotChartOptions = ({
|
|||||||
if (threshold.thresholdLabel) {
|
if (threshold.thresholdLabel) {
|
||||||
const text = threshold.thresholdLabel;
|
const text = threshold.thresholdLabel;
|
||||||
const textX = plotRight - ctx.measureText(text).width - 20;
|
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.fillStyle = threshold.thresholdColor || 'red';
|
||||||
ctx.fillText(text, textX, textY);
|
ctx.fillText(text, textX, textY);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user