Pie Chart - No Label Shown
See original GitHub issueTrying to get a label shown on a simple pie chart. No lines or anything are shown.
var COLORS = ['#3DCC91', '#FFB366', '#FF7373', '#FFCC00', '#3B22FF'];
<PieChart width={300} height={200}>
<Pie data={data} cx="50%" cy="50%" dataKey="value" label={true} labelLine={true}>
{
data.map((entry, index) => (
<Cell key={index} fill={COLORS[index % COLORS.length]} />
))
}
</Pie>
<Tooltip />
<Legend />
</PieChart>
Why do none of the examples work on jsFiddle or on the main site? It just renders blank page.
UPDATE So, I dropped back to version 0.22.4 and it shows the label. The latest version doesn’t show it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:41 (1 by maintainers)
Top Results From Across the Web
pandas pie chart plot remove the label text on the wedge
I want to remove the text label (a,b,c,d) from both subplots, because for my application those label are long, so I only want...
Read more >How to remove the label on the left side in matplotlib.pyplot ...
Plot a pie chart using pie() method. To hide the label on the left side in matplotlib, we can use plt.ylabel("") with ablank...
Read more >Pie Chart Not Showing all Data Labels
Solved: I have a few pie charts that are not showing all the data labels. Does anyone have a way of getting them...
Read more >Add or remove data labels in a chart - Microsoft Support
To change the location, click the arrow, and choose an option. If you want to show your data label inside a text bubble...
Read more >Labeling a pie and a donut — Matplotlib 3.6.2 documentation
Welcome to the Matplotlib bakery. We will create a pie and a donut chart through the pie method and show how to label...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my case setting isAnimationActive={false} resolves the issue. Of course this means doing without the animation.
The line of code below seems to be the problem -
https://github.com/recharts/recharts/blob/master/src/polar/Pie.js#L346
The intent is to not render labels until animation completes which makes sense. However, there appears to be a race condition that means labels are never rendered.
Why this was closed? The problem still exists (Recharts 1.3.4).