Skip to content

MiniPie

MiniPie renders a small inline SVG pie chart. Unlike plot layers, it behaves like a regular DOM element: pass class, style, or other SVG attributes to tune its size, alignment, and surrounding layout.

Import

ts
import { MiniPie } from '@putianyi888/vue3-plots'

Example

vue
<MiniPie
  class="summary-icon"
  :data="[
    { value: 2, color: '#2563eb' },
    { value: 1, color: '#dc2626' },
  ]"
  :radius="8"
  stroke-color="#ffffff"
  :stroke-width="1"
  style="width: 1rem; vertical-align: middle;"
/>

Props

PropTypeDefaultDescription
strokeWidthnumber1Slice outline width in SVG units.
strokeColorstring'none'Slice outline color.
radiusnumber8Circle radius in SVG units. Pass a positive value.
totalnumberTotal value used to normalize segments. Defaults to the sum of positive finite values.
startAnglenumber0Start angle in degrees. Zero degrees points right.
dataPieDatum[]RequiredPie segments in drawing order.

Notes

Use CSS when you want the rendered element to occupy a different layout size than its intrinsic SVG size.

MiniPie does not validate radius values. Pass a positive finite radius; invalid SVG radius values are passed through to the generated path data and may not render.