ChartTooltip
Loading example…
Floating card that lists every series at the hovered position. Purely
visual (aria-hidden): screen readers get the same numbers from the live
region and the hidden data table. Moves with a GPU transform, so following
the pointer never triggers layout. Its own width is measured so the card
always stays inside the container: it takes the side of the anchor with
room, and is clamped to the edges when neither side fits (narrow charts).
The side only changes past a dead zone, and a side swap jumps instead of
sliding across the pointer.
Docked (see dock), the same rows render in the frame’s live panel below
the plot instead, which is how touch screens read them.
Import
Section titled “Import”import { ChartTooltip } from "@jcsoftdev/ui/charts";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/charts/core.
<ChartTooltip x={120} y={80} containerWidth={420} title="Sábado 4 oct" rows={rows}/>| Prop | Type | Default | Description |
|---|---|---|---|
x * |
number |
Anchor in pixels, relative to the positioned chart container. | |
y * |
number |
||
containerWidth * |
number |
Width of the container; the tooltip prefers the left of the anchor past 60% and never leaves it. | |
containerHeight |
number |
Height of the container; when given, the card is kept inside it vertically too. | |
title |
ReactNode |
||
rows * |
readonly TooltipRow[] |
||
body |
string |
Wrapped sentence under the title, for notes that are not series values. | |
footer |
ReactNode |
Content under the rows. | |
side |
"left" | "right" |
Forces the side of the anchor the card opens on (when it fits); by default it follows the anchor. | |
dock |
"auto" | "always" | "never" |
"auto" |
auto (default) docks the details in the frame’s panel under the plot when the frame is 480px wide or less, or the primary pointer is coarse. never always floats. always docks whenever the enclosing ChartFrame has a panel, which it only has when it doc… |
className |
string |
* marks a required prop.
Storybook stories
Section titled “Storybook stories”Source
Section titled “Source”packages/ui/src/charts/core/tooltip.tsx