Skip to content

Commit

Permalink
feat: add ChartLegend
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Oct 9, 2024
1 parent 3361fa1 commit a07113a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/[locale]/(main)/ClientComponents/NetworkChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
import {
ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart";
Expand Down Expand Up @@ -228,6 +230,9 @@ export function NetworkChart({
/>
}
/>
{activeChart === defaultChart && (
<ChartLegend content={<ChartLegendContent />} />
)}
{activeChart !== defaultChart && (
<Line
isAnimationActive={false}
Expand Down
4 changes: 2 additions & 2 deletions components/ui/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const ChartLegendContent = React.forwardRef<
<div
ref={ref}
className={cn(
"flex items-center justify-center gap-4",
"flex flex-wrap items-center justify-center gap-4",
verticalAlign === "top" ? "pb-3" : "pt-3",
className,
)}
Expand All @@ -306,7 +306,7 @@ const ChartLegendContent = React.forwardRef<
}}
/>
)}
{itemConfig?.label}
{key}
</div>
);
})}
Expand Down

0 comments on commit a07113a

Please sign in to comment.