Pie Chart

Pie charts express portions of a whole, using arcs or angles within a circle.

TypeResource
DesignFigma
WebWeb Storybook
CodeGitlab

Usage

import { PieChart } from 'bio-bind-ui';
<PieChart
  data={{
    datasets: [
      {
        backgroundColor: ['#0098B0', '#12B76A', '#FF6E00', '#FFC733'],
        borderWidth: 0,
        data: [700, 400, 300, 200],
        label: 'Dataset',
      },
    ],
    labels: ['Dataset 1', 'Dataset 2', 'Dataset 3', 'Dataset 4'],
  }}
  id='pie-chart-preview'
  mode='light'
  options={{
    plugins: {
      legend: {
        position: 'top',
      },
    },
  }}
  size='md'
/>

Examples

Size

Set the size prop to sm, md, or lg.

Legend (optional)

Use position and set to top, right, left, or bottom to place legend position

Mode (optional)

Use mode to use dark or light


Props

PropsRequiredDefaultTypedescription
idfalse-stringA unique identifier for the pie chart.
datatrue{{}}objectObject to define labels[] and datasets[].
optionsfalse{{}}objectObject to configure options for the chart.
pluginsfalse{{}}objectObject to configure plugins for the chart.
modefalselightlight darkThe theme mode of the pie chart (light or dark).
sizefalse-sm md lgSize of pie chart.
widthfalse-number[] | stringSet the width of pie chart.
heightfalse-number[] | stringSet the height of pie chart.
hideLegendfalsefalsetrue falseShow and hide the chart legend.
BIND © Biofarma Innovate Next-level Design .