Donut
AlphaA line chart visually represents data in a circular form, similar to a pie chart but with a central void, emphasizing proportions within categories.
Installation
Run the following command
npx sigma-ui add chart card chart-donutSetup
Follow the guide to complete the setup.
API
Prop
colors
string[]Change the default colors.
index
stringRequired*Sets the key to map the data to the axis.
data
Record<string, any>[]Required*The source data, in which each entry is a dictionary.
margin
SpacingMargin of each the container
filterOpacity
numberChange the opacity of the non-selected field
showTooltip
booleanControls the visibility of tooltip.
showLegend
booleanControls the visibility of legend.
category
stringRequired*Sets the name of the key containing the quantitative chart values.
type
'donut' | 'pie'Change the type of the chart
sortFunction
((a: any, b: any) => number)Function to sort the segment
valueFormatter
((tick: number, i?: number, ticks?: number[]) => string)Controls the formatting for the label.
customTooltip
ComponentRender custom tooltip component.
Examples
Pie Chart
If you want to render pie chart instead, pass type as pie.
Color
We generate colors automatically based on the primary and secondary color and assigned them accordingly. Feel free to pass in your own array of colors.
Custom Tooltip
If you want to render custom tooltip, you can easily pass in a custom component. Refer to prop definition here.