Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Chart examples · Tooltip

Tooltip - No Indicator Chart for React

A chart tooltip without color indicators, showing the label, names and values.

Framework
UI library

The tooltip with hideIndicator: the title, then each series' name and value, without the color marks.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How do I remove the color dots?

ChartTooltipContent sets hideIndicator. The dots are omitted. The title, the series names, and the values stay. This demo doesn't set indicator, so the hidden shape would have been the default dot.

What is left in each row?

The label from config, Running or Swimming, and the value with toLocaleString, in font-mono and tabular-nums. nameKey isn't set, so the lookup uses the series key, running or swimming.

What is the tooltip title?

The raw date from XAxis, like 2024-07-16, because hideLabel is not set and there is no labelFormatter. The axis itself uses tickFormatter={formatWeekday}, a short weekday. tickMargin is 10.

Why is a tooltip open on load?

ChartTooltip sets defaultIndex={1} and cursor={false}. Index 1 is the second row. cursor={false} turns the hover cursor off. BarChart sets accessibilityLayer.

How are the bars stacked?

Both Bar components set stackId="a". Running is first, on the baseline, with radius={[0, 0, 4, 4]} and fill="var(--color-running)". Swimming is on top, with radius={[4, 4, 0, 0]} and fill="var(--color-swimming)".

Where do the bar colors come from if the tooltip has no dots?

config sets running to var(--chart-1) and swimming to var(--chart-2). ChartContainer writes --color-running and --color-swimming, and the bars' fill reads them. The tooltip names the series. The bars carry the color.