Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charts #4181

Merged
merged 61 commits into from
Jul 5, 2024
Merged

Charts #4181

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b625c3d
chore: wip charts
shadcn May 2, 2024
8d8176f
feat: chart updates
shadcn May 24, 2024
b3799ba
feat: simplified chart work
shadcn May 29, 2024
8c1952a
feat: chart demo
shadcn May 29, 2024
7921122
feat: wip charts
shadcn Jun 3, 2024
f97f871
feat: charts wip
shadcn Jul 1, 2024
14d3f4b
fix: build
shadcn Jul 1, 2024
c92f752
feat: charts wip
shadcn Jul 2, 2024
f218153
feat: radial
shadcn Jul 2, 2024
fdfbb7e
feat: line charts
shadcn Jul 3, 2024
93ba203
feat: update charts
shadcn Jul 3, 2024
56eb066
feat: chart themes
shadcn Jul 3, 2024
ba829c1
feat: chart colors
shadcn Jul 3, 2024
e605824
refactor: color for charts
shadcn Jul 3, 2024
9168a23
feat: chart
shadcn Jul 3, 2024
1a7c9f9
feat: update chart display
shadcn Jul 3, 2024
dc99d80
fix: mobile display
shadcn Jul 3, 2024
ba2fcdb
fix: charts display
shadcn Jul 3, 2024
53c6be0
feat: build registry
shadcn Jul 3, 2024
8d57b74
fix: disable code highlight
shadcn Jul 3, 2024
29b20b7
fix: code highlight
shadcn Jul 3, 2024
c37755c
feat: add view code
shadcn Jul 3, 2024
7893d8a
fix: chart display
shadcn Jul 3, 2024
27bdbb6
fix: charts
shadcn Jul 3, 2024
e2d8891
fix: hydration
shadcn Jul 3, 2024
66cb1ca
fix: headline
shadcn Jul 3, 2024
c165b08
feat: update code handling
shadcn Jul 4, 2024
516dbf1
fix: code display
shadcn Jul 4, 2024
f53366c
fix: remove charts mobile
shadcn Jul 4, 2024
81332d3
feat: update chart primitive
shadcn Jul 4, 2024
c2e6391
chore: build
shadcn Jul 4, 2024
5c9f13d
docs: updates
shadcn Jul 4, 2024
67aac2f
fix: page slug
shadcn Jul 4, 2024
32fc64d
docs: charts
shadcn Jul 4, 2024
0e46fca
docs: theming
shadcn Jul 4, 2024
d3f6e7a
feat: update docs
shadcn Jul 4, 2024
3429c61
fix: registry
shadcn Jul 4, 2024
56193e9
chore: update pnpm action
shadcn Jul 4, 2024
39d6547
chore: update pnpm version
shadcn Jul 4, 2024
da6b561
fix: formatting
shadcn Jul 4, 2024
4e8e510
fix: docs callout
shadcn Jul 4, 2024
885f436
fix: update style handling
shadcn Jul 4, 2024
19537c1
fix: bugs
shadcn Jul 4, 2024
339765e
fix: bugs
shadcn Jul 4, 2024
208b47f
fix: bugs
shadcn Jul 4, 2024
4523d0d
fix: bugs
shadcn Jul 4, 2024
c92372d
fix: format
shadcn Jul 4, 2024
22efff8
fix: update chart examples
shadcn Jul 5, 2024
a2ba113
docs: update chart docs
shadcn Jul 5, 2024
17a6da4
feat: add v0 button
shadcn Jul 5, 2024
5971d9e
fix: edit in v0 url
shadcn Jul 5, 2024
0352380
fix: url handling
shadcn Jul 5, 2024
fdedbbe
fix: announcement
shadcn Jul 5, 2024
a6dc92b
docs: fix
shadcn Jul 5, 2024
7f7d748
docs: charts
shadcn Jul 5, 2024
45523e7
fix: update chart description
shadcn Jul 5, 2024
2a5142e
Merge branch 'main' into shadcn/charts
shadcn Jul 5, 2024
e4ad798
docs: cleanup
shadcn Jul 5, 2024
7d4f861
fix: chart colors
shadcn Jul 5, 2024
10fda13
docs: charts
shadcn Jul 5, 2024
c8ad3c2
docs: charts
shadcn Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
version: 9.0.6
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -54,11 +54,11 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
version: 9.0.6
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -92,11 +92,11 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
version: 9.0.6
run_install: false

- name: Get pnpm store directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
fetch-depth: 0

- name: Use PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
version: 8.6.1
version: 9.0.6

- name: Use Node.js 18
uses: actions/setup-node@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
fetch-depth: 0

- name: Use PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
version: 8.6.1
version: 9.0.6

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
version: 8.6.1
version: 9.0.6
node-version: 18
cache: "pnpm"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
version: 9.0.6
run_install: false

- name: Get pnpm store directory
Expand Down
110 changes: 110 additions & 0 deletions apps/www/__registry__/default/block/chart-area-axes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
"use client"

import { TrendingUp } from "lucide-react"
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/default/ui/chart"

export const description = "An area chart with axes"

const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]

const chartConfig = {
desktop: {
label: "Desktop",
color: "hsl(var(--chart-1))",
},
mobile: {
label: "Mobile",
color: "hsl(var(--chart-2))",
},
} satisfies ChartConfig

export default function Component() {
return (
<Card>
<CardHeader>
<CardTitle>Area Chart - Axes</CardTitle>
<CardDescription>
Showing total visitors for the last 6 months
</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: -20,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
tickCount={3}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<Area
dataKey="mobile"
type="natural"
fill="var(--color-mobile)"
fillOpacity={0.4}
stroke="var(--color-mobile)"
stackId="a"
/>
<Area
dataKey="desktop"
type="natural"
fill="var(--color-desktop)"
fillOpacity={0.4}
stroke="var(--color-desktop)"
stackId="a"
/>
</AreaChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className="flex w-full items-start gap-2 text-sm">
<div className="grid gap-2">
<div className="flex items-center gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="flex items-center gap-2 leading-none text-muted-foreground">
January - June 2024
</div>
</div>
</div>
</CardFooter>
</Card>
)
}
94 changes: 94 additions & 0 deletions apps/www/__registry__/default/block/chart-area-default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"use client"

import { TrendingUp } from "lucide-react"
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/default/ui/chart"

export const description = "A simple area chart"

const chartData = [
{ month: "January", desktop: 186 },
{ month: "February", desktop: 305 },
{ month: "March", desktop: 237 },
{ month: "April", desktop: 73 },
{ month: "May", desktop: 209 },
{ month: "June", desktop: 214 },
]

const chartConfig = {
desktop: {
label: "Desktop",
color: "hsl(var(--chart-1))",
},
} satisfies ChartConfig

export default function Component() {
return (
<Card>
<CardHeader>
<CardTitle>Area Chart</CardTitle>
<CardDescription>
Showing total visitors for the last 6 months
</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator="line" />}
/>
<Area
dataKey="desktop"
type="natural"
fill="var(--color-desktop)"
fillOpacity={0.4}
stroke="var(--color-desktop)"
/>
</AreaChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className="flex w-full items-start gap-2 text-sm">
<div className="grid gap-2">
<div className="flex items-center gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="flex items-center gap-2 leading-none text-muted-foreground">
January - June 2024
</div>
</div>
</div>
</CardFooter>
</Card>
)
}
Loading
Loading