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.

Failed prop type: The prop `dataKey` is marked as required in `Pie`, but its value is `undefined`. in Pie (created by PieChartContainer)

See original GitHub issue

My current implementation of the PieChart component works, but throws the following error in the console.

Failed prop type: The prop dataKey is marked as required in Pie, but its value is undefined. in Pie (created by PieChartContainer)

I’ve bumped my Recharts version to the latest build of Recharts 1.0.0.alpha.1 which allowed the Pie chart to render, but didn’t suppress the error.

Is this working as intended?

See a snippet of my implementation below…

```
    <PieChart onMouseEnter={this.onPieEnter}>
          <Pie data={this.props.data} labelLine={false} label={renderCustomizedLabel} innerRadius={60} outerRadius={120} fill="#8884d8">
            { this.props.data.map((entry, index) => <Cell key={index} fill={this.COLORS[index % this.COLORS.length]}/>) }
          </Pie>
          <Tooltip/>
          <Legend />
        </PieChart>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
cj4luvcommented, Jun 22, 2017

you should add prop ‘dataKey’ in ‘Pie’ component.

example

    <PieChart width={800} height={400} >
      <Pie dataKey="value" data={data} cx={250} cy={200} innerRadius={112} outerRadius={122} >
        {
          data.map((entry, index) => <Cell key={index} fill={COLORS[index % COLORS.length]}/>)
        }
      </Pie>
      <Tooltip/>
    </PieChart>
10reactions
deboviscommented, Nov 6, 2017

@xile611

adding prop ‘dataKey’='value in ‘Pie’ component solved the problem, please update the following example. Thanks

http://recharts.org/#/en-US/examples/CustomActiveShapePieChart

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed prop type: The prop `dataKey` is marked as required in `Pie ...
Failed prop type : The prop `dataKey` is marked as required in `Pie`, but its value is `undefined`. in Pie (created by PieChartContainer)...
Read more >
Prop is marked as required in component, but its value is ...
In console, I am getting an error : Warning: Failed prop type: The prop item is marked as required in Details , but...
Read more >
the prop is marked as required in but its value is undefined
Failed prop type: The prop `dataKey` is marked as required in `Pie`, but its value is `undefined`. in Pie (created by PieChartContainer) #740....
Read more >
mozilla-central: changeset 166805 ...
Turn a DOM Node and offset into a character offset into this hypertext. ... + "A pie chart container was created successfully."); +...
Read more >
Legacy examples | Donut / Pie chart - Developer - SEMrush
import { PieChart, Pie, Cell, Tooltip as TooltipChart, getColor } from '@semcore/chart' ... commonValue = data.reduce((acc, entry) => acc + entry.value, 0);.
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