@reincharts/tooltip

Legends and tooltips.

npm install @reincharts/tooltip

Everything here is also re-exported by the umbrella package reincharts.

Components

NameDescription
LegendPane legend in the top-left corner of a pane: name and values of every series at the crosshair (or the last bar).
TooltipFloating tooltip that follows the pointer: a card with the hovered x and the values of the pane's series.
TooltipCardThe default tooltip card (exported to build custom tooltips with the same look).

Hooks

NameDescription
useLegendLegend entries of a pane at the crosshair (or the last bar when there is no crosshair).

Functions

NameDescription
collectLegendLegend entries of a pane at a data index (like engine.legendItems, but keeping the renderables).
defaultHeaderFormatted x of a data point; numbers get a precision that suits their magnitude.
formatChangeFormats a change as "+1.23 (+0.52%)".
sameEntriesDeep equality of legend entry lists (used to skip re-renders).

Types

NameDescription
CollectOptions
LegendEntry
LegendItemContextContext passed to renderItem / actions.
LegendPosition
LegendPropsProps of the Legend component.
LegendState
TooltipCardPropsProps of the TooltipCard component.
TooltipContentWhat a tooltip shows at the hovered point.
TooltipPropsProps of the Tooltip component.

On this page