# Line Chart

ASCII line chart with axes and multi-series support



<ComponentPreview base="ink" name="line-chart-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/line-chart
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="line-chart" title="components/ui/line-chart.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { LineChart } from "@/components/ui/line-chart";
```

```tsx
<LineChart
  data={[
    { label: "Jan", value: 30 },
    { label: "Feb", value: 45 },
    { label: "Mar", value: 28 },
  ]}
  width={40}
  height={10}
  title="Monthly Sales"
/>
```

API Reference [#api-reference]

LineChart [#linechart]

| Prop       | Type                                              | Default    |
| ---------- | ------------------------------------------------- | ---------- |
| `data`     | `(number \| { label?: string; value: number })[]` | `required` |
| `width`    | `number`                                          | `40`       |
| `height`   | `number`                                          | `10`       |
| `title`    | `string`                                          | -          |
| `color`    | `string`                                          | -          |
| `showAxes` | `boolean`                                         | `true`     |
