import {Chart, bar, line} from '@astryxdesign/charts';
<Chart
data={monthlyRevenue}
xKey="month"
series={[
bar('revenue', {label: 'Revenue'}),
line('forecast', {label: 'Forecast'}),
]}
tooltip
/>;Chart Tooltip
ChartTooltip shows grouped values for the chart position nearest the pointer. Use Chart’s tooltip prop or its configuration object for the standard integration; direct composition remains available when you need explicit child composition.
Authored source examples
Source examples recorded in the documentation for this entry.
import {Chart, ChartTooltip, line} from '@astryxdesign/charts';
const series = [line('revenue', {label: 'Revenue'})];
<Chart data={monthlyRevenue} xKey="month" series={series}>
<ChartTooltip
series={series}
placement="top"
showHoverDots={false}
/>
</Chart>;Usage
ChartTooltip shows grouped values for the chart position nearest the pointer. Use Chart’s tooltip prop or its configuration object for the standard integration; direct composition remains available when you need explicit child composition.
- Treat tooltip content as supplemental pointer detail. Give the parent Chart an accessible name and preserve its equivalent data table or another complete data view.
- When composing ChartTooltip directly, pass the same series definitions used by Chart so rows, swatches, and hover dots stay aligned with the plotted marks.
- Put information required to understand the chart only in the tooltip. The current interaction is pointer-driven and does not establish a focus trigger or aria-describedby relationship.
- Render interactive controls inside the custom tooltip body. The surface is presentational and does not accept pointer input.
Typed props
| Prop | Type and behavior |
|---|---|
series | readonly SeriesDef[] · default [] |
render | (xValue: unknown, seriesValues: TooltipSeriesValue[]) => ReactNode · default Default grouped value contentReplaces the default card body. Return null to hide the card while preserving enabled hover indicators and dots. |
hoverIndicator | boolean · default trueShows a band highlight for bar series on a band scale, or a vertical crosshair for other series. |
showHoverDots | boolean · default trueShows a point marker for each eligible non-bar series at the hovered index. |
placement | 'auto' | 'right' | 'left' | 'top' · default 'auto'Selects one of the shipped placement algorithms. The current implementation positions from the hovered x coordinate and the plot top; whether placement should instead be point-relative on both axes remains unresolved. Custom renderers own their content sizing. |
Anatomy
Layer host mounted under the chart’s nearest HTML container so nested Theme and MediaTheme scopes remain inherited. It uses the browser top layer when the Popover API is available and otherwise keeps the card visible through Layer’s reduced fallback.
Non-interactive surface containing the current x value and series values.
For multi-series charts, a decorative swatch, visible label, and value.
Band highlight for bar series on a band scale, or a vertical crosshair otherwise.
Point marker for each eligible non-bar series at the hovered data index.
Accessibility
The tooltip supplements the parent Chart. It does not replace the Chart accessible name, hidden data table, summary, or another equivalent data view.
The visible card uses role tooltip. Chart does not currently expose a focusable data-point trigger or an aria-describedby relationship, so required information must remain available outside this pointer-only surface.