Skip to content

Pie Chart ^0.1.18 ​

Proportional slices from a whole. Supports pie, donut, padding, rounded corners, custom colors, legend, and center text.

Basic ​

62%19%9%5%5%
Chrome62
Safari19
Edge9
Firefox5
Other5
vue
<VxPieChart :data="browsers" />

Donut ​

62%19%9%5%5%
Chrome62
Safari19
Edge9
Firefox5
Other5
vue
<VxPieChart :data="browsers" donut />

Donut with center text ​

57%27%14%2%$8.5kMonthly revenue
Enterprise4.8k
Business2.3k
Pro1.2k
Free180
vue
<VxPieChart :data="revenue" donut centerText="$8.5k" centerSubtext="Monthly revenue" />

Custom colors ​

44%17%10%7%22%$2.7kMonthly spend
Housing1.2k
Food450
Transport280
Entertainment180
Savings600
vue
<VxPieChart
  :data="[
    { name: 'Housing', value: 1200, color: '#6366f1' },
    { name: 'Food',    value: 450,  color: '#22c55e' },
    ...
  ]"
  donut
/>

With slice labels ​

Chrome62%Safari19%Edge9%Firefox5%Other5%
Chrome62
Safari19
Edge9
Firefox5
Other5
vue
<VxPieChart :data="data" showLabels />

Values instead of percents ​

4.8k2.3k1.2k180
Enterprise4.8k
Business2.3k
Pro1.2k
Free180
vue
<VxPieChart :data="data" donut showValues :showPercents="false" />

Storage gauge (binary donut) ​

68%32%68%of 500 GB used
vue
<VxPieChart
  :data="[
    { name: 'Used', value: 68, color: '#6366f1' },
    { name: 'Free', value: 32, color: 'var(--muted)' },
  ]"
  donut
  :innerRadius="0.72"
  :legend="false"
  centerText="68%"
  centerSubtext="of 500 GB used"
/>

No padding, no corner radius ​

39%28%16%10%7%
Direct45
Organic32
Referral18
Social12
Email8
vue
<VxPieChart :data="data" :padAngle="0" :cornerRadius="0" />

Live updates ​

42%28%18%12%
Option A42
Option B28
Option C18
Option D12
vue
<VxButton @click="addVote">Add random votes</VxButton>
<VxPieChart :data="votes" donut />

Interactive playground ​

62%19%9%5%5%
Chrome62
Safari19
Edge9
Firefox5
Other5

Props ​

PropTypeDefaultDescription
datanumber[] | PieChartSlice[][]Values or { name, value, color? }[]
labelsstring[][]Names when data is numbers
sizenumber280Chart diameter
donutbooleanfalseRender as donut
innerRadiusnumber0.55Donut inner ratio (0–1)
padAnglenumber0.015Gap between slices in radians
cornerRadiusnumber2Slice corner radius
colorsstring[][]Palette override
legendbooleantrueShow legend
showLabelsbooleanfalseInline slice name
showValuesbooleanfalseInline numeric value
showPercentsbooleantrueInline percent
centerTextstring''Donut center title
centerSubtextstring''Donut center subtitle
startAnglenumber-90Starting angle in degrees
tooltipbooleantrueShow hover tooltip
animatebooleantrueSweep-in on mount
animationDurationnumber700Animation ms

Events ​

EventPayload
hover{ index, slice }
click{ index, slice }