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.

466 B
Raw Blame
export function calculateWidthBasedOnStepInterval({
	uPlotInstance,
	stepInterval,
}: {
	uPlotInstance: uPlot;
	stepInterval: number;
}): number {
	const xScale = uPlotInstance.scales.x;
	if (xScale && typeof xScale.min === 'number') {
		const start = xScale.min as number;
		const end = start + stepInterval;
		const startPx = uPlotInstance.valToPos(start, 'x');
		const endPx = uPlotInstance.valToPos(end, 'x');
		return Math.abs(endPx - startPx);
	}
	return 0;
}