chart/01-chart-basic-line
Loading interactive preview
import { Chart } from 'ui-lab-components/chart';
export const metadata = {
title: 'Basic Line Chart',
description: 'A line chart with axes, grid lines, and a tooltip for inspecting values.'
};
const data = [
{ month: 'Jan', revenue: 42 },
{ month: 'Feb', revenue: 58 },
{ month: 'Mar', revenue: 51 },
{ month: 'Apr', revenue: 76 },
{ month: 'May', revenue: 68 },
{ month: 'Jun', revenue: 89 }
];
export default function Example() {
return (
<Chart data={data} x="month" aria-label="Monthly revenue">
<Chart.Grid />
<Chart.Axis axis="x" />
<Chart.Axis axis="y" />
<Chart.Line y="revenue" label="Revenue" />
<Chart.Tooltip />
</Chart>
);
}