Exciting Update: Version 1.0.2 is now available, introducing full TradingView Lightweight Charts API parity, multi-series support, log & percentage scales, series markers, and price lines. Read more
Version: 1.0.0

Crosshair Lines

The tracking crosshair lines (horizontal and vertical) must follow mouse coordinates dynamically. Because they are 1-pixel wide, they must use half-pixel alignment to remain sharp.

Tracking Offset

When translating screen coordinates, the crosshair coordinates are rounded using:

const drawX = Math.floor(mouseX) + 0.5;
const drawY = Math.floor(mouseY) + 0.5;

This avoids blurred, anti-aliased gray lines, ensuring they remain solid black or primary colored lines as the user tracks prices.