diff --git a/apps/v4/content/docs/components/base/chart.mdx b/apps/v4/content/docs/components/base/chart.mdx index c9a015271b..01861edb21 100644 --- a/apps/v4/content/docs/components/base/chart.mdx +++ b/apps/v4/content/docs/components/base/chart.mdx @@ -5,9 +5,9 @@ base: base component: true --- - + -**Recharts v3:** The `chart` component now targets Recharts v3. Use `ChartTooltip.defaultIndex` for initial tooltip state, but keep persistent active shapes in your own chart state. Also remove `layout` from `` when `BarChart` already sets it, and keep a height or `min-h-*` on `ChartContainer`. +**Updated:** The `chart` component now uses Recharts v3. If you're upgrading existing chart code, see [Updating to Recharts v3](#updating-to-recharts-v3). @@ -51,6 +51,15 @@ We do not wrap Recharts. This means you're not locked into an abstraction. When **The components are yours**. +## Updating to Recharts v3 + +If you're updating older chart code to Recharts v3: + +- Use `var(--chart-1)` instead of `hsl(var(--chart-1))` when you reference chart tokens from your CSS variables. +- Use `ChartTooltip.defaultIndex` for initial tooltip state only. Keep persistent active shapes in your own chart state. +- Remove `layout` from `` when the parent `` already defines it. +- Keep a height, `min-h-*`, or `aspect-*` on `ChartContainer` so `ResponsiveContainer` can measure on first render. + ## Installation diff --git a/apps/v4/content/docs/components/radix/chart.mdx b/apps/v4/content/docs/components/radix/chart.mdx index 71c135937f..8d9e140888 100644 --- a/apps/v4/content/docs/components/radix/chart.mdx +++ b/apps/v4/content/docs/components/radix/chart.mdx @@ -5,9 +5,9 @@ base: radix component: true --- - + -**Recharts v3:** The `chart` component now targets Recharts v3. Use `ChartTooltip.defaultIndex` for initial tooltip state, but keep persistent active shapes in your own chart state. Also remove `layout` from `` when `BarChart` already sets it, and keep a height or `min-h-*` on `ChartContainer`. +**Updated:** The `chart` component now uses Recharts v3. If you're upgrading existing chart code, see [Updating to Recharts v3](#updating-to-recharts-v3). @@ -51,6 +51,15 @@ We do not wrap Recharts. This means you're not locked into an abstraction. When **The components are yours**. +## Updating to Recharts v3 + +If you're updating older chart code to Recharts v3: + +- Use `var(--chart-1)` instead of `hsl(var(--chart-1))` when you reference chart tokens from your CSS variables. +- Use `ChartTooltip.defaultIndex` for initial tooltip state only. Keep persistent active shapes in your own chart state. +- Remove `layout` from `` when the parent `` already defines it. +- Keep a height, `min-h-*`, or `aspect-*` on `ChartContainer` so `ResponsiveContainer` can measure on first render. + ## Installation diff --git a/apps/v4/examples/base/chart-tooltip.tsx b/apps/v4/examples/base/chart-tooltip.tsx index b4f2aee682..096e2c698a 100644 --- a/apps/v4/examples/base/chart-tooltip.tsx +++ b/apps/v4/examples/base/chart-tooltip.tsx @@ -173,7 +173,7 @@ function TooltipDemo({ {!hideIndicator && (
\n \n Bar Chart - Active\n January - June 2024\n \n \n \n \n \n \n chartConfig[value as keyof typeof chartConfig]?.label\n }\n />\n } />\n \n index === ACTIVE_INDEX ? (\n \n ) : (\n \n )\n }\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n \n )\n}\n", + "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport { Bar, BarChart, CartesianGrid, Rectangle, XAxis } from \"recharts\"\nimport type { BarShapeProps } from \"recharts/types/cartesian/Bar\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A bar chart with an active bar\"\n\nconst chartData = [\n { browser: \"chrome\", visitors: 187, fill: \"var(--color-chrome)\" },\n { browser: \"safari\", visitors: 200, fill: \"var(--color-safari)\" },\n { browser: \"firefox\", visitors: 275, fill: \"var(--color-firefox)\" },\n { browser: \"edge\", visitors: 173, fill: \"var(--color-edge)\" },\n { browser: \"other\", visitors: 90, fill: \"var(--color-other)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n chrome: {\n label: \"Chrome\",\n color: \"var(--chart-1)\",\n },\n safari: {\n label: \"Safari\",\n color: \"var(--chart-2)\",\n },\n firefox: {\n label: \"Firefox\",\n color: \"var(--chart-3)\",\n },\n edge: {\n label: \"Edge\",\n color: \"var(--chart-4)\",\n },\n other: {\n label: \"Other\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nconst ACTIVE_INDEX = 2\n\nexport function ChartBarActive() {\n return (\n \n \n Bar Chart - Active\n January - June 2024\n \n \n \n \n \n \n chartConfig[value as keyof typeof chartConfig]?.label\n }\n />\n }\n />\n \n index === ACTIVE_INDEX ? (\n \n ) : (\n \n )\n }\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n
\n )\n}\n", "type": "registry:block" } ], diff --git a/apps/v4/public/r/styles/new-york-v4/chart-pie-donut-active.json b/apps/v4/public/r/styles/new-york-v4/chart-pie-donut-active.json index 419664068a..ed137c95db 100644 --- a/apps/v4/public/r/styles/new-york-v4/chart-pie-donut-active.json +++ b/apps/v4/public/r/styles/new-york-v4/chart-pie-donut-active.json @@ -8,7 +8,7 @@ "files": [ { "path": "registry/new-york-v4/charts/chart-pie-donut-active.tsx", - "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport { Label, Pie, PieChart, Sector } from \"recharts\"\nimport type { PieSectorShapeProps } from \"recharts/types/polar/Pie\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A donut chart with an active sector\"\n\nconst chartData = [\n { browser: \"chrome\", visitors: 275, fill: \"var(--color-chrome)\" },\n { browser: \"safari\", visitors: 200, fill: \"var(--color-safari)\" },\n { browser: \"firefox\", visitors: 187, fill: \"var(--color-firefox)\" },\n { browser: \"edge\", visitors: 173, fill: \"var(--color-edge)\" },\n { browser: \"other\", visitors: 90, fill: \"var(--color-other)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n chrome: {\n label: \"Chrome\",\n color: \"var(--chart-1)\",\n },\n safari: {\n label: \"Safari\",\n color: \"var(--chart-2)\",\n },\n firefox: {\n label: \"Firefox\",\n color: \"var(--chart-3)\",\n },\n edge: {\n label: \"Edge\",\n color: \"var(--chart-4)\",\n },\n other: {\n label: \"Other\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nconst ACTIVE_INDEX = 0\n\nexport function ChartPieDonutActive() {\n return (\n \n \n Pie Chart - Donut Active\n January - June 2024\n \n \n \n \n } />\n \n index === ACTIVE_INDEX ? (\n \n ) : (\n \n )\n }\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n
\n )\n}\n", + "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport { Label, Pie, PieChart, Sector } from \"recharts\"\nimport type { PieSectorShapeProps } from \"recharts/types/polar/Pie\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A donut chart with an active sector\"\n\nconst chartData = [\n { browser: \"chrome\", visitors: 275, fill: \"var(--color-chrome)\" },\n { browser: \"safari\", visitors: 200, fill: \"var(--color-safari)\" },\n { browser: \"firefox\", visitors: 187, fill: \"var(--color-firefox)\" },\n { browser: \"edge\", visitors: 173, fill: \"var(--color-edge)\" },\n { browser: \"other\", visitors: 90, fill: \"var(--color-other)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n chrome: {\n label: \"Chrome\",\n color: \"var(--chart-1)\",\n },\n safari: {\n label: \"Safari\",\n color: \"var(--chart-2)\",\n },\n firefox: {\n label: \"Firefox\",\n color: \"var(--chart-3)\",\n },\n edge: {\n label: \"Edge\",\n color: \"var(--chart-4)\",\n },\n other: {\n label: \"Other\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nconst ACTIVE_INDEX = 0\n\nexport function ChartPieDonutActive() {\n return (\n \n \n Pie Chart - Donut Active\n January - June 2024\n \n \n \n \n }\n />\n \n index === ACTIVE_INDEX ? (\n \n ) : (\n \n )\n }\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n
\n )\n}\n", "type": "registry:block" } ], diff --git a/apps/v4/public/r/styles/new-york-v4/chart-pie-interactive.json b/apps/v4/public/r/styles/new-york-v4/chart-pie-interactive.json index 5ff8673bbd..9879027b00 100644 --- a/apps/v4/public/r/styles/new-york-v4/chart-pie-interactive.json +++ b/apps/v4/public/r/styles/new-york-v4/chart-pie-interactive.json @@ -8,7 +8,7 @@ "files": [ { "path": "registry/new-york-v4/charts/chart-pie-interactive.tsx", - "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Label, Pie, PieChart, Sector } from \"recharts\"\nimport type {\n PieSectorDataItem,\n PieSectorShapeProps,\n} from \"recharts/types/polar/Pie\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/new-york-v4/ui/select\"\n\nexport const description = \"An interactive pie chart\"\n\nconst desktopData = [\n { month: \"january\", desktop: 186, fill: \"var(--color-january)\" },\n { month: \"february\", desktop: 305, fill: \"var(--color-february)\" },\n { month: \"march\", desktop: 237, fill: \"var(--color-march)\" },\n { month: \"april\", desktop: 173, fill: \"var(--color-april)\" },\n { month: \"may\", desktop: 209, fill: \"var(--color-may)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n desktop: {\n label: \"Desktop\",\n },\n mobile: {\n label: \"Mobile\",\n },\n january: {\n label: \"January\",\n color: \"var(--chart-1)\",\n },\n february: {\n label: \"February\",\n color: \"var(--chart-2)\",\n },\n march: {\n label: \"March\",\n color: \"var(--chart-3)\",\n },\n april: {\n label: \"April\",\n color: \"var(--chart-4)\",\n },\n may: {\n label: \"May\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nexport function ChartPieInteractive() {\n const id = \"pie-interactive\"\n const [activeMonth, setActiveMonth] = React.useState(desktopData[0].month)\n\n const activeIndex = React.useMemo(\n () => desktopData.findIndex((item) => item.month === activeMonth),\n [activeMonth]\n )\n const months = React.useMemo(() => desktopData.map((item) => item.month), [])\n\n const renderPieShape = React.useCallback(\n ({ index, outerRadius = 0, ...props }: PieSectorShapeProps) => {\n if (index === activeIndex) {\n return (\n \n \n \n \n )\n }\n\n return \n },\n [activeIndex]\n )\n\n return (\n \n \n \n
\n Pie Chart - Interactive\n January - June 2024\n
\n \n
\n \n \n \n } />\n \n {\n if (viewBox && \"cx\" in viewBox && \"cy\" in viewBox) {\n return (\n \n \n {desktopData[activeIndex].desktop.toLocaleString()}\n \n \n Visitors\n \n \n )\n }\n }}\n />\n \n \n \n \n
\n )\n}\n", + "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Label, Pie, PieChart, Sector } from \"recharts\"\nimport type {\n PieSectorDataItem,\n PieSectorShapeProps,\n} from \"recharts/types/polar/Pie\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/new-york-v4/ui/select\"\n\nexport const description = \"An interactive pie chart\"\n\nconst desktopData = [\n { month: \"january\", desktop: 186, fill: \"var(--color-january)\" },\n { month: \"february\", desktop: 305, fill: \"var(--color-february)\" },\n { month: \"march\", desktop: 237, fill: \"var(--color-march)\" },\n { month: \"april\", desktop: 173, fill: \"var(--color-april)\" },\n { month: \"may\", desktop: 209, fill: \"var(--color-may)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n desktop: {\n label: \"Desktop\",\n },\n mobile: {\n label: \"Mobile\",\n },\n january: {\n label: \"January\",\n color: \"var(--chart-1)\",\n },\n february: {\n label: \"February\",\n color: \"var(--chart-2)\",\n },\n march: {\n label: \"March\",\n color: \"var(--chart-3)\",\n },\n april: {\n label: \"April\",\n color: \"var(--chart-4)\",\n },\n may: {\n label: \"May\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nexport function ChartPieInteractive() {\n const id = \"pie-interactive\"\n const [activeMonth, setActiveMonth] = React.useState(desktopData[0].month)\n\n const activeIndex = React.useMemo(\n () => desktopData.findIndex((item) => item.month === activeMonth),\n [activeMonth]\n )\n const months = React.useMemo(() => desktopData.map((item) => item.month), [])\n\n const renderPieShape = React.useCallback(\n ({ index, outerRadius = 0, ...props }: PieSectorShapeProps) => {\n if (index === activeIndex) {\n return (\n \n \n \n \n )\n }\n\n return \n },\n [activeIndex]\n )\n\n return (\n \n \n \n
\n Pie Chart - Interactive\n January - June 2024\n
\n \n
\n \n \n \n }\n />\n \n {\n if (viewBox && \"cx\" in viewBox && \"cy\" in viewBox) {\n return (\n \n \n {desktopData[activeIndex].desktop.toLocaleString()}\n \n \n Visitors\n \n \n )\n }\n }}\n />\n \n \n \n \n
\n )\n}\n", "type": "registry:block" } ], diff --git a/apps/v4/public/r/styles/new-york-v4/chart-pie-label-custom.json b/apps/v4/public/r/styles/new-york-v4/chart-pie-label-custom.json index 83732abd32..437c44569a 100644 --- a/apps/v4/public/r/styles/new-york-v4/chart-pie-label-custom.json +++ b/apps/v4/public/r/styles/new-york-v4/chart-pie-label-custom.json @@ -8,7 +8,7 @@ "files": [ { "path": "registry/new-york-v4/charts/chart-pie-label-custom.tsx", - "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport { Pie, PieChart } from \"recharts\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A pie chart with a custom label\"\n\nconst chartData = [\n { browser: \"chrome\", visitors: 275, fill: \"var(--color-chrome)\" },\n { browser: \"safari\", visitors: 200, fill: \"var(--color-safari)\" },\n { browser: \"firefox\", visitors: 187, fill: \"var(--color-firefox)\" },\n { browser: \"edge\", visitors: 173, fill: \"var(--color-edge)\" },\n { browser: \"other\", visitors: 90, fill: \"var(--color-other)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n chrome: {\n label: \"Chrome\",\n color: \"var(--chart-1)\",\n },\n safari: {\n label: \"Safari\",\n color: \"var(--chart-2)\",\n },\n firefox: {\n label: \"Firefox\",\n color: \"var(--chart-3)\",\n },\n edge: {\n label: \"Edge\",\n color: \"var(--chart-4)\",\n },\n other: {\n label: \"Other\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nexport function ChartPieLabelCustom() {\n return (\n \n \n Pie Chart - Custom Label\n January - June 2024\n \n \n \n \n }\n />\n {\n return (\n \n {payload.visitors}\n \n )\n }}\n nameKey=\"browser\"\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n
\n )\n}\n", + "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport { Pie, PieChart } from \"recharts\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A pie chart with a custom label\"\n\nconst chartData = [\n { browser: \"chrome\", visitors: 275, fill: \"var(--color-chrome)\" },\n { browser: \"safari\", visitors: 200, fill: \"var(--color-safari)\" },\n { browser: \"firefox\", visitors: 187, fill: \"var(--color-firefox)\" },\n { browser: \"edge\", visitors: 173, fill: \"var(--color-edge)\" },\n { browser: \"other\", visitors: 90, fill: \"var(--color-other)\" },\n]\n\nconst chartConfig = {\n visitors: {\n label: \"Visitors\",\n },\n chrome: {\n label: \"Chrome\",\n color: \"var(--chart-1)\",\n },\n safari: {\n label: \"Safari\",\n color: \"var(--chart-2)\",\n },\n firefox: {\n label: \"Firefox\",\n color: \"var(--chart-3)\",\n },\n edge: {\n label: \"Edge\",\n color: \"var(--chart-4)\",\n },\n other: {\n label: \"Other\",\n color: \"var(--chart-5)\",\n },\n} satisfies ChartConfig\n\nexport function ChartPieLabelCustom() {\n return (\n \n \n Pie Chart - Custom Label\n January - June 2024\n \n \n \n \n }\n />\n {\n return (\n \n {payload.visitors}\n \n )\n }}\n nameKey=\"browser\"\n />\n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n Showing total visitors for the last 6 months\n
\n
\n
\n )\n}\n", "type": "registry:block" } ], diff --git a/apps/v4/public/r/styles/new-york-v4/chart-radar-radius.json b/apps/v4/public/r/styles/new-york-v4/chart-radar-radius.json index e387cef2bf..80ca18f508 100644 --- a/apps/v4/public/r/styles/new-york-v4/chart-radar-radius.json +++ b/apps/v4/public/r/styles/new-york-v4/chart-radar-radius.json @@ -8,7 +8,7 @@ "files": [ { "path": "registry/new-york-v4/charts/chart-radar-radius.tsx", - "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport {\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart,\n} from \"recharts\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A radar chart with a radius axis\"\n\nconst chartData = [\n { month: \"January\", desktop: 186, mobile: 80 },\n { month: \"February\", desktop: 305, mobile: 200 },\n { month: \"March\", desktop: 237, mobile: 120 },\n { month: \"April\", desktop: 73, mobile: 190 },\n { month: \"May\", desktop: 209, mobile: 130 },\n { month: \"June\", desktop: 214, mobile: 140 },\n]\n\nconst chartConfig = {\n desktop: {\n label: \"Desktop\",\n color: \"var(--chart-1)\",\n },\n mobile: {\n label: \"Mobile\",\n color: \"var(--chart-2)\",\n },\n} satisfies ChartConfig\n\nexport function ChartRadarRadius() {\n return (\n \n \n Radar Chart - Radius Axis\n \n Showing total visitors for the last 6 months\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n January - June 2024\n
\n
\n
\n )\n}\n", + "content": "\"use client\"\n\nimport { TrendingUp } from \"lucide-react\"\nimport {\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart,\n} from \"recharts\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"@/registry/new-york-v4/ui/card\"\nimport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n type ChartConfig,\n} from \"@/registry/new-york-v4/ui/chart\"\n\nexport const description = \"A radar chart with a radius axis\"\n\nconst chartData = [\n { month: \"January\", desktop: 186, mobile: 80 },\n { month: \"February\", desktop: 305, mobile: 200 },\n { month: \"March\", desktop: 237, mobile: 120 },\n { month: \"April\", desktop: 73, mobile: 190 },\n { month: \"May\", desktop: 209, mobile: 130 },\n { month: \"June\", desktop: 214, mobile: 140 },\n]\n\nconst chartConfig = {\n desktop: {\n label: \"Desktop\",\n color: \"var(--chart-1)\",\n },\n mobile: {\n label: \"Mobile\",\n color: \"var(--chart-2)\",\n },\n} satisfies ChartConfig\n\nexport function ChartRadarRadius() {\n return (\n \n \n Radar Chart - Radius Axis\n \n Showing total visitors for the last 6 months\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n \n \n
\n Trending up by 5.2% this month \n
\n
\n January - June 2024\n
\n
\n
\n )\n}\n", "type": "registry:block" } ], diff --git a/apps/v4/public/r/styles/new-york-v4/chart-tooltip-demo.json b/apps/v4/public/r/styles/new-york-v4/chart-tooltip-demo.json index 25edcf1ee9..aaf112b55b 100644 --- a/apps/v4/public/r/styles/new-york-v4/chart-tooltip-demo.json +++ b/apps/v4/public/r/styles/new-york-v4/chart-tooltip-demo.json @@ -4,7 +4,7 @@ "files": [ { "path": "registry/new-york-v4/examples/chart-tooltip-demo.tsx", - "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport default function Component() {\n return (\n
div]:relative [&>div]:flex [&>div]:h-[137px] [&>div]:w-[224px] [&>div]:items-center [&>div]:justify-center [&>div]:p-4\">\n
\n
\n Label\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n Name\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n
\n Indicator\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n )\n}\n\nfunction TooltipDemo({\n indicator = \"dot\",\n label,\n payload,\n hideLabel,\n hideIndicator,\n className,\n}: {\n label: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n payload: {\n name: string\n value: number\n fill: string\n }[]\n nameKey?: string\n labelKey?: string\n} & React.ComponentProps<\"div\">) {\n const tooltipLabel = hideLabel ? null : (\n
{label}
\n )\n\n if (!payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n \n {!nestLabel ? tooltipLabel : null}\n
\n {payload.map((item, index) => {\n const indicatorColor = item.fill\n\n return (\n svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n <>\n {!hideIndicator && (\n \n )}\n \n
\n {nestLabel ? tooltipLabel : null}\n {item.name}\n
\n \n {item.value.toLocaleString()}\n \n
\n \n
\n )\n })}\n \n \n )\n}\n", + "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport default function Component() {\n return (\n
div]:relative [&>div]:flex [&>div]:h-[137px] [&>div]:w-[224px] [&>div]:items-center [&>div]:justify-center [&>div]:p-4\">\n
\n
\n Label\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n Name\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n
\n Indicator\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n )\n}\n\nfunction TooltipDemo({\n indicator = \"dot\",\n label,\n payload,\n hideLabel,\n hideIndicator,\n className,\n}: {\n label: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n payload: {\n name: string\n value: number\n fill: string\n }[]\n nameKey?: string\n labelKey?: string\n} & React.ComponentProps<\"div\">) {\n const tooltipLabel = hideLabel ? null : (\n
{label}
\n )\n\n if (!payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n \n {!nestLabel ? tooltipLabel : null}\n
\n {payload.map((item, index) => {\n const indicatorColor = item.fill\n\n return (\n svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n <>\n {!hideIndicator && (\n \n )}\n \n
\n {nestLabel ? tooltipLabel : null}\n {item.name}\n
\n \n {item.value.toLocaleString()}\n \n
\n \n \n )\n })}\n \n \n )\n}\n", "type": "registry:example" } ], diff --git a/apps/v4/registry/new-york-v4/charts/chart-pie-label-custom.tsx b/apps/v4/registry/new-york-v4/charts/chart-pie-label-custom.tsx index addae4e95b..465c78c2a8 100644 --- a/apps/v4/registry/new-york-v4/charts/chart-pie-label-custom.tsx +++ b/apps/v4/registry/new-york-v4/charts/chart-pie-label-custom.tsx @@ -83,7 +83,7 @@ export function ChartPieLabelCustom() { y={props.y} textAnchor={props.textAnchor} dominantBaseline={props.dominantBaseline} - fill="hsla(var(--foreground))" + fill="var(--foreground)" > {payload.visitors} diff --git a/apps/v4/registry/new-york-v4/charts/chart-radar-radius.tsx b/apps/v4/registry/new-york-v4/charts/chart-radar-radius.tsx index e6b66e2c2e..61f29bb5b8 100644 --- a/apps/v4/registry/new-york-v4/charts/chart-radar-radius.tsx +++ b/apps/v4/registry/new-york-v4/charts/chart-radar-radius.tsx @@ -76,7 +76,7 @@ export function ChartRadarRadius() { diff --git a/apps/v4/registry/new-york-v4/examples/chart-tooltip-demo.tsx b/apps/v4/registry/new-york-v4/examples/chart-tooltip-demo.tsx index 5e3e0492c4..5b4a31ae66 100644 --- a/apps/v4/registry/new-york-v4/examples/chart-tooltip-demo.tsx +++ b/apps/v4/registry/new-york-v4/examples/chart-tooltip-demo.tsx @@ -34,8 +34,8 @@ export default function Component() { @@ -68,8 +68,8 @@ export default function Component() { label="Browser" hideLabel payload={[ - { name: "Chrome", value: 1286, fill: "hsl(var(--chart-3))" }, - { name: "Firefox", value: 1000, fill: "hsl(var(--chart-4))" }, + { name: "Chrome", value: 1286, fill: "var(--chart-3)" }, + { name: "Firefox", value: 1000, fill: "var(--chart-4)" }, ]} indicator="dashed" className="w-[8rem]" @@ -78,9 +78,7 @@ export default function Component() {
@@ -92,9 +90,7 @@ export default function Component() { @@ -177,7 +173,7 @@ function TooltipDemo({ {!hideIndicator && (