suiss/ui · Chart
Tooltip Chart Formatter
A bar chart of daily active energy whose tooltip shows a name, value and kcal unit through a custom formatter.
Tooltip Chart Formatter is an open-source chart from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.
A week of active-energy bars whose tooltip row is rewritten by a formatter to show a name, value and kcal unit. Use a formatter like this when values need units, thousands separators or extra context.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies:
-
Copy the source into
components/charts/tooltip-chart-formatter.tsx:
- Update the import paths to match your project.
Usage
Pass a formatter to ChartTooltipContent; it receives each row's value and name and returns the markup for that row. Change the label text, number format and unit inside it, and replace chartData and chartConfig with your series.
Notes
Dates are parsed at noon so the weekday labels don't shift a day in time zones behind UTC; keep that if you use date strings as categories.