sisense.com
✅ You are viewing documentation for the latest version of Compose SDK.
Version:

Function PieChart

PieChart(props): Promise< ReactNode > | ReactNode

A React component representing data in a circular graph with the data shown as slices of a whole, with each slice representing a proportion of the total.

Parameters

ParameterTypeDescription
propsPieChartPropsPie chart properties

Returns

Promise< ReactNode > | ReactNode

Pie Chart component

Example

Pie chart displaying total revenue per age range from the Sample ECommerce data model.

import { PieChart } from '@sisense/sdk-ui';
import { measureFactory } from '@sisense/sdk-data';
import * as DM from './sample-ecommerce';

const CodeExample = () => (
  <PieChart
    dataSet={DM.DataSource}
    dataOptions={{
      category: [DM.Commerce.AgeRange],
      value: [measureFactory.sum(DM.Commerce.Revenue, 'Total Revenue')],
    }}
    styleOptions={{ subtype: 'pie/classic' }}
  />
);

export default CodeExample;
Pie chart example 1

Donut chart variant, using the same data:

<PieChart
  dataSet={DM.DataSource}
  dataOptions={{
    category: [DM.Commerce.AgeRange],
    value: [measureFactory.sum(DM.Commerce.Revenue, 'Total Revenue')],
  }}
  styleOptions={{ subtype: 'pie/donut' }}
/>
Pie chart example 2

Ring chart variant, using the same data:

<PieChart
  dataSet={DM.DataSource}
  dataOptions={{
    category: [DM.Commerce.AgeRange],
    value: [measureFactory.sum(DM.Commerce.Revenue, 'Total Revenue')],
  }}
  styleOptions={{ subtype: 'pie/ring' }}
/>
Pie chart example 3
Last Updated: