shadcn.io is not affiliated with official shadcn/ui
Chart examples · Tooltip
Tooltip - No Label Chart for React
A chart tooltip without a label or indicators, showing only names and values.
The most compact tooltip: hideLabel and hideIndicator leave only each series' name and value.
Preview
Installation
FAQ
How do I show only the names and values?
ChartTooltipContent sets hideLabel and hideIndicator. hideLabel hides the tooltip title. hideIndicator hides the color dot. Each row is the label from config, Running or Swimming, and the value.
How is the value formatted?
ChartTooltipContent prints a numeric value with toLocaleString, using font-mono and tabular-nums. This demo doesn't set formatter, so there is no unit after the number. The series name comes from config, not from the data key.
Where did the date go?
It stays on XAxis. dataKey is date, and tickFormatter is formatWeekday, a short weekday. axisLine and tickLine are false, and tickMargin is 10. The tooltip no longer repeats that date.
Why is a tooltip open on load?
ChartTooltip sets defaultIndex={1} and cursor={false}. Index 1 is the second row, 2024-07-16. cursor={false} turns the hover cursor off. BarChart sets accessibilityLayer.
Related
- Tooltip - Default ChartThe default chart tooltip, with a label
- Tooltip - Custom Label ChartA chart tooltip whose label comes from a
- Tooltip - No Indicator ChartA chart tooltip without color indicators
- Tooltip - Formatter ChartA chart tooltip that formats each row
- A bar chartA bar chart with rounded corners
- A line chartA line chart drawing one series as a