A pie chart is a circular statistical graphic which is divided into slices to illustrate numerical proportion.
For a pie chart we must define an rx.recharts.pie() component for each set of values we wish to plot. Each rx.recharts.pie() component has a data, a data_key and a name_key which clearly states which data and which variables in our data we are tracking. In this simple example we plot value column as our data_key against the name column which we set as our name_key.
We also use the fill prop to set the color of the pie slices.
We can also add two pies on one chart by using two rx.recharts.pie components.
In this example inner_radius and outer_radius props are used. They define the doughnut shape of a pie chart: inner_radius creates the hollow center (use "0%" for a full pie), while outer_radius sets the overall size. The padding_angle prop, used on the green pie below, adds space between pie slices, enhancing visibility of individual segments.
Chart data tied to a State var causes the chart to automatically update when the state changes, providing a nice way to visualize data in response to user interface elements. View the "Data" tab to see the substate driving this half-pie chart.
π1
πͺ΅1
π₯1
π§±1
API Reference
rx.recharts.PieChart
A Pie chart component in Recharts.
Valid Children
PolarAngleAxisPolarRadiusAxisPolarGridLegendGraphingTooltipPie