ChartLegendContent() — ui Function Reference
Architecture documentation for the ChartLegendContent() function in chart.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD ef08f55b_60e4_ae82_1121_40ab4e4aaa68["ChartLegendContent()"] 3cb17edd_61fe_ddea_c637_f0228f3d8c28["chart.tsx"] ef08f55b_60e4_ae82_1121_40ab4e4aaa68 -->|defined in| 3cb17edd_61fe_ddea_c637_f0228f3d8c28 e7e8f607_d74b_5114_a997_952a021f8a9b["useChart()"] ef08f55b_60e4_ae82_1121_40ab4e4aaa68 -->|calls| e7e8f607_d74b_5114_a997_952a021f8a9b c631eb70_bd79_f6d9_de12_12897a9ae1b0["getPayloadConfigFromPayload()"] ef08f55b_60e4_ae82_1121_40ab4e4aaa68 -->|calls| c631eb70_bd79_f6d9_de12_12897a9ae1b0 style ef08f55b_60e4_ae82_1121_40ab4e4aaa68 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/new-york-v4/ui/chart.tsx lines 255–309
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/registry/new-york-v4/ui/chart.tsx.
Where is ChartLegendContent() defined?
ChartLegendContent() is defined in apps/v4/registry/new-york-v4/ui/chart.tsx at line 255.
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