ChartLegendContent() — ui Function Reference
Architecture documentation for the ChartLegendContent() function in chart.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 73ecd05f_cdfe_812b_d6f0_ba313a91d39c["ChartLegendContent()"] 4f126d71_ecf3_d37f_a804_0d9b0ac0f9a9["chart.tsx"] 73ecd05f_cdfe_812b_d6f0_ba313a91d39c -->|defined in| 4f126d71_ecf3_d37f_a804_0d9b0ac0f9a9 6862488e_a650_d784_a293_18ec9134f013["useChart()"] 73ecd05f_cdfe_812b_d6f0_ba313a91d39c -->|calls| 6862488e_a650_d784_a293_18ec9134f013 7e18f420_c680_d688_87f0_6b124e597d5b["getPayloadConfigFromPayload()"] 73ecd05f_cdfe_812b_d6f0_ba313a91d39c -->|calls| 7e18f420_c680_d688_87f0_6b124e597d5b style 73ecd05f_cdfe_812b_d6f0_ba313a91d39c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/examples/radix/ui/chart.tsx lines 254–308
function ChartLegendContent({
className,
hideIcon = false,
payload,
verticalAlign = "bottom",
nameKey,
}: React.ComponentProps<"div"> &
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
hideIcon?: boolean
nameKey?: string
}) {
const { config } = useChart()
if (!payload?.length) {
return null
}
return (
<div
className={cn(
"flex items-center justify-center gap-4",
verticalAlign === "top" ? "pb-3" : "pt-3",
className
)}
>
{payload
.filter((item) => item.type !== "none")
.map((item) => {
const key = `${nameKey || item.dataKey || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key)
return (
<div
key={item.value}
className={cn(
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
)}
>
{itemConfig?.icon && !hideIcon ? (
<itemConfig.icon />
) : (
<div
className="h-2 w-2 shrink-0 rounded-[2px]"
style={{
backgroundColor: item.color,
}}
/>
)}
{itemConfig?.label}
</div>
)
})}
</div>
)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does ChartLegendContent() do?
ChartLegendContent() is a function in the ui codebase, defined in apps/v4/examples/radix/ui/chart.tsx.
Where is ChartLegendContent() defined?
ChartLegendContent() is defined in apps/v4/examples/radix/ui/chart.tsx at line 254.
What does ChartLegendContent() call?
ChartLegendContent() calls 2 function(s): getPayloadConfigFromPayload, useChart.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free