question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pie Chart - No Label Shown

See original GitHub issue

Trying 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:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:41 (1 by maintainers)

github_iconTop GitHub Comments

40reactions
pebanfieldcommented, Nov 30, 2017

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.

31reactions
drastuscommented, Oct 19, 2018

Why this was closed? The problem still exists (Recharts 1.3.4).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found