Skip to content

Donut Chart

Display proportional data as a donut chart with a hollow center, perfect for dashboards and data visualization.

Loading chart...

Installation

bash
npx @galaxy-stack/nebula-cli@latest add donut-chart
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add donut-chart
bash
yarn dlx @galaxy-stack/nebula-cli@latest add donut-chart
bash
bunx @galaxy-stack/nebula-cli@latest add donut-chart

Dependencies

This component automatically installs the following dependencies:

  • Vue: vue-echarts@^7.0.3, echarts@^5.5.1
  • React: echarts-for-react@^3.0.2, echarts@^5.5.1
  • Angular: ngx-echarts@^18.0.0, echarts@^5.5.1
  • React Native: @wuba/react-native-echarts@^3.0.1, echarts@^5.5.1, @shopify/react-native-skia@^1.6.4
  • Flutter: fl_chart@^0.68.0

Features

  • 🍩 Hollow Center - Distinctive donut shape with customizable inner radius
  • 📊 Data Visualization - Perfect for showing proportions and percentages
  • 🎨 Customizable - Full control over colors, labels, and styling
  • 📱 Responsive - Adapts to all screen sizes
  • 🌓 Dark Mode - Built-in dark theme support
  • Performance - Optimized rendering for smooth interactions

Use Cases

  • Dashboard KPIs - Display key metrics with visual impact
  • Market Share - Show distribution across categories
  • Budget Allocation - Visualize spending or resource distribution
  • Progress Tracking - Show completion status
  • Survey Results - Display poll or survey data

API Reference

Props

PropTypeDefaultDescription
dataChartDatarequiredChart data with labels and datasets
heightnumber300Chart height in pixels
widthnumber | string"100%"Chart width
theme"light" | "dark""light"Color theme
legendbooleantrueShow/hide legend
legendPosition"top" | "bottom" | "left" | "right""right"Legend position
innerRadiusnumber50Inner radius percentage (0-100)
outerRadiusnumber70Outer radius percentage (0-100)
showPercentagebooleantrueShow percentage in labels
labelPosition"inside" | "outside" | "center""outside"Label position
loadingbooleanfalseShow loading state
emptyTextstring"No data available"Text shown when no data

ChartData Interface

typescript
interface ChartData {
  labels: string[]
  datasets: ChartDataset[]
}

interface ChartDataset {
  label: string
  data: number[]
  backgroundColor?: string[]
}

Examples

Custom Inner Radius

Adjust the hollow center size:

vue
<DonutChart :data="data" :innerRadius="60" />
tsx
<DonutChart data={data} innerRadius={60} />

Inside Labels

Display labels inside the segments:

vue
<DonutChart :data="data" labelPosition="inside" />
tsx
<DonutChart data={data} labelPosition="inside" />

Dark Theme

vue
<DonutChart :data="data" theme="dark" />
tsx
<DonutChart data={data} theme="dark" />

Released under the MIT License.