> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pharen.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Chart

> Import and use the Chart components from @pharen/ui.

export const PharenUiPreview = ({name, title = 'Pharen UI component preview'}) => <div className="not-prose my-6 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm dark:border-white/10 dark:bg-zinc-950">
    <div className="pharen-ui-preview-root" data-pharen-ui-preview data-example={name} role="region" aria-label={title} />
  </div>;

Use **Chart** to visualize quantitative data. This page covers every Vue component exported by the public module.

<PharenUiPreview name="chart" title="Chart preview" />

<Accordion title="View code">
  ```vue theme={null}
  <script setup lang="ts">
  import { ChartDonutBreakdown, type ChartConfig } from '@pharen/ui';

  const data = [
    { key: 'completed', label: 'Completed', value: 68, chartValue: 68, fill: 'var(--primary)', meta: '68 runs' },
    { key: 'running', label: 'Running', value: 21, chartValue: 21, fill: 'var(--info)', meta: '21 runs' },
    { key: 'failed', label: 'Failed', value: 11, chartValue: 11, fill: 'var(--destructive)', meta: '11 runs' },
  ];
  const config: ChartConfig = {
    completed: { label: 'Completed', color: 'var(--primary)' },
    running: { label: 'Running', color: 'var(--info)' },
    failed: { label: 'Failed', color: 'var(--destructive)' },
  };
  </script>

  <template>
    <ChartDonutBreakdown
      title="Workflow runs"
      description="Status distribution for the last 100 runs."
      :data="data"
      :config="config"
      center-eyebrow="Total"
      center-label="Runs"
      center-value="100"
      empty-text="No runs yet"
      :tooltip-template="item => `${item.label}: ${item.value}%`"
      class="w-full max-w-lg"
    />
  </template>
  ```
</Accordion>

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @pharen/ui
  ```

  ```bash pnpm theme={null}
  pnpm add @pharen/ui
  ```

  ```bash yarn theme={null}
  yarn add @pharen/ui
  ```

  ```bash bun theme={null}
  bun add @pharen/ui
  ```
</CodeGroup>

<Note>
  Import `@pharen/ui/styles.css` exactly once in your application entrypoint.
</Note>

## Usage

```ts theme={null}
import { ChartContainer, ChartDonutBreakdown, ChartLegendContent, ChartStyle, ChartTooltipContent, ChartCrosshair, ChartTooltip, VisDonut, VisAnnotations, VisSingleContainer, VisXYContainer, VisXYLabels, VisLine, VisArea, VisAxis, VisStackedBar, VisGroupedBar, Donut, Line, Area, StackedBar, GroupedBar } from '@pharen/ui';
```

## Exports

| Export                | Purpose                                  |
| --------------------- | ---------------------------------------- |
| `ChartContainer`      | Exported Vue component from this module. |
| `ChartDonutBreakdown` | Exported Vue component from this module. |
| `ChartLegendContent`  | Contains the visible content.            |
| `ChartStyle`          | Exported Vue component from this module. |
| `ChartTooltipContent` | Contains the visible content.            |
| `ChartCrosshair`      | Exported Vue component from this module. |
| `ChartTooltip`        | Exported Vue component from this module. |
| `VisDonut`            | Exported Vue component from this module. |
| `VisAnnotations`      | Exported Vue component from this module. |
| `VisSingleContainer`  | Exported Vue component from this module. |
| `VisXYContainer`      | Exported Vue component from this module. |
| `VisXYLabels`         | Exported Vue component from this module. |
| `VisLine`             | Exported Vue component from this module. |
| `VisArea`             | Exported Vue component from this module. |
| `VisAxis`             | Exported Vue component from this module. |
| `VisStackedBar`       | Exported Vue component from this module. |
| `VisGroupedBar`       | Exported Vue component from this module. |
| `Donut`               | Exported Vue component from this module. |
| `Line`                | Exported Vue component from this module. |
| `Area`                | Exported Vue component from this module. |
| `StackedBar`          | Exported Vue component from this module. |
| `GroupedBar`          | Exported Vue component from this module. |

## Source

[Open the source on GitHub](https://github.com/PharenIT/ELEV8-Labs/tree/main/src/packages/ui/src/components/chart)
