{
"name": "area-chart",
"snippet": null,
"examples": [
{
"name": "area-chart-basic",
"content": "\"use client\"\nexport const AreaChartBasic = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n }\n />\n } />\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-fill-with-value",
"content": "\"use client\"\nconst data = [\n { name: \"Product A\", uv: 4000, pv: 2400, amt: 2400 },\n { name: \"Product B\", uv: 3000, pv: 1398, amt: 2210 },\n { name: \"Product C\", uv: -1000, pv: 9800, amt: 2290 },\n { name: \"Product D\", uv: 500, pv: 3908, amt: 2000 },\n { name: \"Product E\", uv: -2000, pv: 4800, amt: 2181 },\n { name: \"Product F\", uv: -250, pv: 3800, amt: 2500 },\n { name: \"Product G\", uv: 3490, pv: 4300, amt: 2100 },\n]\n\nconst gradientOffset = () => {\n const max = Math.max(...data.map((i) => i.uv))\n const min = Math.min(...data.map((i) => i.uv))\n if (max <= 0) return 0\n if (min >= 0) return 1\n return max / (max - min)\n}\n\nconst offset = gradientOffset()\n\nexport const AreaChartFillWithValue = () => {\n const chart = useChart({\n data,\n series: [\n { name: \"uv\", color: \"teal.solid\" },\n { name: \"pv\", color: \"purple.solid\" },\n ],\n })\n\n return (\n \n \n \n value.replace(\"Product \", \"\")}\n />\n \n }\n />\n \n \n \n \n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import { Area, AreaChart, CartesianGrid, Tooltip, XAxis, YAxis } from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-percent",
"content": "\"use client\"\nexport const AreaChartPercent = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n \n }\n />\n } />\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-signed",
"content": "\"use client\"\nexport const AreaChartSigned = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: -165, mac: 95, linux: 110, month: \"February\" },\n { windows: 175, mac: 90, linux: -115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: -91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n \n }\n />\n } />\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-axis-label",
"content": "\"use client\"\nexport const AreaChartWithAxisLabel = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n value.slice(0, 3)}\n >\n \n \n \n \n \n \n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import { Area, AreaChart, Label, Tooltip, XAxis, YAxis } from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-dashed-area",
"content": "\"use client\"\nexport const AreaChartWithDashedArea = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\", strokeDasharray: \"5 3\" },\n { name: \"mac\", color: \"orange.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n }\n />\n } />\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-dots",
"content": "\"use client\"\nexport const AreaChartWithDots = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 349, month: \"August\" },\n { windows: 180, mac: 86, linux: 400, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n \n value.slice(0, 3)}\n />\n }\n />\n } />\n\n {chart.series.map((item) => (\n \n ))}\n\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-gradient",
"content": "\"use client\"\nexport const AreaChartWithGradient = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n \n }\n />\n } />\n\n {chart.series.map((item) => (\n \n \n \n ))}\n\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-nulls",
"content": "\"use client\"\nexport const AreaChartWithNulls = () => {\n const chart = useChart({\n data: [\n { sales: 186, month: \"January\" },\n { sales: null, month: \"February\" },\n { sales: 190, month: \"March\" },\n { sales: 195, month: \"May\" },\n { sales: null, month: \"June\" },\n { sales: 175, month: \"August\" },\n { sales: 180, month: \"October\" },\n { sales: 185, month: \"November\" },\n { sales: 300, month: \"December\" },\n ],\n series: [{ name: \"sales\", color: \"teal.solid\" }],\n })\n\n return (\n \n \n {(connectNulls) => (\n \n \n {``}\n \n \n \n \n value.slice(0, 3)}\n />\n }\n />\n {chart.series.map((item) => (\n \n ))}\n \n \n \n )}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import { Box, For, Heading, SimpleGrid } from \"@chakra-ui/react\"",
"import { Area, AreaChart, CartesianGrid, Tooltip, XAxis } from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-point-label",
"content": "\"use client\"\nexport const AreaChartWithPointLabel = () => {\n const chart = useChart({\n data: [\n { sales: 186, month: \"January\" },\n { sales: 40, month: \"February\" },\n { sales: 190, month: \"March\" },\n { sales: 195, month: \"May\" },\n { sales: 240, month: \"June\" },\n { sales: 175, month: \"August\" },\n { sales: 180, month: \"October\" },\n { sales: 185, month: \"November\" },\n { sales: 300, month: \"December\" },\n ],\n series: [{ name: \"sales\", color: \"teal.solid\" }],\n })\n\n return (\n \n \n \n value.slice(0, 3)}\n />\n }\n />\n } />\n {chart.series.map((item) => (\n \n ))}\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n Tooltip,\n XAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-reference-area",
"content": "\"use client\"\nexport const AreaChartWithReferenceArea = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n \n value.slice(0, 3)}\n ticks={[\"February\", \"June\"]}\n />\n }\n />\n } />\n \n \n \n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n ReferenceArea,\n ReferenceLine,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-reference-lines",
"content": "\"use client\"\nexport const AreaChartWithReferenceLines = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n \n \n value.slice(0, 3)}\n />\n }\n />\n } />\n \n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import {\n Area,\n AreaChart,\n CartesianGrid,\n Legend,\n ReferenceLine,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-types",
"content": "\"use client\"\nconst curveTypes = [\n \"linear\",\n \"bump\",\n \"basis\",\n \"step\",\n \"stepBefore\",\n \"stepAfter\",\n \"natural\",\n \"monotone\",\n] as const\n\nexport const AreaChartWithTypes = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"orange.solid\" },\n { name: \"linux\", color: \"blue.solid\" },\n ],\n })\n\n return (\n \n \n {(type) => (\n \n \n {``}\n \n \n \n \n value.slice(0, 3)}\n />\n \n {chart.series.map((item) => (\n \n ))}\n \n \n \n )}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import { For, SimpleGrid, Stack, Text } from \"@chakra-ui/react\"",
"import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
},
{
"name": "area-chart-with-value-axis",
"content": "\"use client\"\nexport const AreaChartWithValueAxis = () => {\n const chart = useChart({\n data: [\n { windows: 186, mac: 80, linux: 120, month: \"January\" },\n { windows: 165, mac: 95, linux: 110, month: \"February\" },\n { windows: 190, mac: 87, linux: 125, month: \"March\" },\n { windows: 195, mac: 88, linux: 130, month: \"May\" },\n { windows: 182, mac: 98, linux: 122, month: \"June\" },\n { windows: 175, mac: 90, linux: 115, month: \"August\" },\n { windows: 180, mac: 86, linux: 124, month: \"October\" },\n { windows: 185, mac: 91, linux: 126, month: \"November\" },\n ],\n series: [\n { name: \"windows\", color: \"teal.solid\" },\n { name: \"mac\", color: \"purple.solid\" },\n { name: \"linux\", color: \"orange.solid\" },\n ],\n })\n\n return (\n \n \n value.slice(0, 3)}\n stroke={chart.color(\"border\")}\n />\n \n }\n />\n {chart.series.map((item) => (\n \n ))}\n \n \n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Chart, useChart } from \"@chakra-ui/charts\"",
"import { Area, AreaChart, Tooltip, XAxis, YAxis } from \"recharts\""
],
"importPath": "import { AreaChart } from \"@chakra-ui/react\"",
"npmDependencies": [
"@chakra-ui/charts",
"recharts"
]
}
]
}