View code
View code
<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>
Installation
npm install @pharen/ui
pnpm add @pharen/ui
yarn add @pharen/ui
bun add @pharen/ui
Import
@pharen/ui/styles.css exactly once in your application entrypoint.Usage
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. |