Foundations

Tooltip & Crosshair

The tooltip presents aligned values across every registered series, keeps annotations in view, and manages the crosshair position. It lives inside `Chart.Root`, so any chart type automatically participates without extra configuration.

Example

Move your cursor across the chart. You'll see the shared tooltip aggregate line, bar, and gauge values while highlighting the active timestamp with a crosshair.

Usage

<Chart.Root data={data} tooltip>
  <Chart.LineSeries x="timestamp" y="supply_temp" name="Supply" unit="°F" />
  <Chart.LineSeries x="timestamp" y="return_temp" name="Return" unit="°F" />
  <Chart.Annotation type="line" y={75} label="Target" />
</Chart.Root>

Units and annotation labels enrich the tooltip without any custom render logic.

Configuration touchpoints

PropTypeDefaultDescription
tooltipbooleantrueRoot-level flag for enabling the shared tooltip, crosshair, and pointer tracking layer.
unitstringPer-series option (Line/Bar/Gauge) that appends a suffix to formatted values inside the tooltip.
showPercentagesbooleanfalseGauge-specific prop that switches tooltip values from raw numbers to percentages.
annotationsChart.Annotation[][]Registered annotations show up in the tooltip when the pointer crosses their reference line.

Best practices

  • Provide `unit` strings on every series so the tooltip does not have to infer units from axis labels.
  • Return cleanup functions from registration hooks (already handled in the chart components) to prevent duplicate tooltip entries when toggling series.
  • Keep the tooltip enabled even for simple charts—it provides keyboard focus states and accessible descriptions for screen-reader users.