Line Chart
A trend line graph for visualizing changes over time.
Examples
import { LineChart } from 'kalki-design'
const data = [
{
"label": "Jan",
"value": 62
},
{
"label": "Feb",
"value": 68
},
{
"label": "Mar",
"value": 74
},
{
"label": "Apr",
"value": 70
},
{
"label": "May",
"value": 84
},
{
"label": "Jun",
"value": 92
}
]
export default function Example() {
return (
<LineChart
data={data}
lineColor="var(--chart-3)"
areaColor="var(--chart-3)"
showGrid={true}
showArea={true}
smooth={true}
showPoints={true}
/>
)
}Installation
npx kalki-design add line-chartUsage
import { LineChart } from 'kalki-design'
const data = [
{ label: 'Jan', value: 18 },
{ label: 'Feb', value: 22 },
{ label: 'Mar', value: 28 },
{ label: 'Apr', value: 24 },
{ label: 'May', value: 34 },
{ label: 'Jun', value: 38 },
]
export default function Example() {
return <LineChart data={data} lineColor="var(--chart-3)" showArea />
}API Reference
| Name | Type | Default | Description |
|---|---|---|---|
Namedata | TypeChartDatum[] | Default— | DescriptionData points containing label and numeric value. |
Nameheight | Typenumber | Default220 | DescriptionChart height in pixels. |
NamelineColor | Typestring | Default'var(--chart-3)' | DescriptionLine stroke color. |
NameshowArea | Typeboolean | Defaulttrue | DescriptionRenders an area fill below the line. |
Namesmooth | Typeboolean | Defaulttrue | DescriptionUses curved interpolation between points. |
NameshowPoints | Typeboolean | Defaulttrue | DescriptionShows point markers on each data point. |