shadcn.io is not affiliated with official shadcn/ui
About
Reach for it when each point is an event as much as a value: a release, a deploy, a commit. The marker reads like a commit on a timeline, so the chart fits developer tools and changelogs. For plain readings, the Line Chart with Dots is quieter.
A natural curve through six months, with each point drawn as a hollow ring on a short vertical stroke in the series color, filled with the card's background. The tooltip shows the value alone.
Installation
Usage
import { ChartLineDotsCustom } from "@/components/charts/chart-line-dots-custom";<ChartLineDotsCustom />Customize
doton<Line>is a function: it getscx,cyand the row'spayloadand returns lucide'sGitCommitVerticalicon.- The icon is 24px, so it's placed at
cx - 12,cy - 12to center it on the point. Changerin the function to resize it. stroke="var(--color-desktop)"colors the icon's outline, andfill="var(--background)"matches the card so the line doesn't show through the ring.- The function returns
nullwhencxorcyis missing, so a gap in the data draws no stray icon. <ChartTooltipContent hideLabel />shows the value alone.
FAQ
How is the commit marker drawn?
<Line>'s dot prop is a function that returns lucide's GitCommitVertical icon at each point, 24px wide, centered on cx and cy.
Can I use a different marker?
Yes. Return any lucide icon, or any SVG, from the dot function. Set its width and height, and offset x and y by half of them so it centers on the point.
Can different months use different markers?
Yes. The dot function gets the row as payload, so it can return a different icon per month, such as a check for a release and an alert for an incident.
Why does the ring stay hollow in dark mode?
The icon's fill is the page background and its stroke is var(--color-desktop). With this theme's OKLCH tokens, pass var(--background) as it is: the hsl(var(--background)) form from older examples isn't a valid color.
API Reference
ChartContainer
configChartConfig
Each series by its data key: its label, an icon, and a color (or a * theme color per light and dark), read by the tooltip and legend and set * as --color-<key>.
initialDimension?{ height: number; width: number; }
The size it renders at before it's measured, so the first paint isn't * empty.
- Type
{ height: number; width: number; }- Default
INITIAL_DIMENSION
className?string
Merged with the part's classes.
ChartLegend
ChartLegendContent
<div>
hideIcon?boolean
Hides each series' icon (from config), leaving its color swatch.
- Default
false
nameKey?string
The key in each legend item's data to look its label up by in config. * Defaults to the item's dataKey.
className?string
Merged with the part's classes.
ChartStyle
<style>
configChartConfig
The chart config whose colors it writes as --color-<key> variables.
idstring
The element's id.
ChartTooltip
ChartTooltipContent
<div>
hideIndicator?boolean
Hides each item's color indicator.
- Default
false
hideLabel?boolean
Hides the tooltip's label, the hovered point's.
- Default
false
indicator?"dashed" | "dot" | "line"
The color indicator's shape: a dot, a line or dashed.
- Type
"dashed" | "dot" | "line"- Default
"dot"
labelFormatter?(label: any, payload: TooltipPayload) → React.ReactNode
Formats the tooltip's label; its value is untyped, as in recharts 3.8.
- Type
(label: any, payload: TooltipPayload) → React.ReactNode- Parameters
label– anypayload– TooltipPayload- Returns
React.ReactNode
labelKey?string
The key in the data to read the label from, looked up in config.
nameKey?string
The key in each item's data to look its name up by in config.
className?string
Merged with the part's classes.
Related
Line Chart with Dots
Line chartsA line with a dot on every data point.
Line Chart with Colored Dots
Line chartsA line whose dots each take their category's color.
Area Chart with Icons
Area chartsStacked areas with an icon beside each series in the legend.
Line Chart with Labels
Line chartsEach point's value printed above the line.
Chart Tooltip with Icons
TooltipsA tooltip with an icon beside each series.
Line Chart
Line chartsOne series as a smooth line over six months.