payload=[] for Tooltip when allowDuplicatedCategory={false} in XAxis
#2348 opened on Dec 21, 2020
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
In demo link just hovering over a bar and open console.
The Tooltip don't show and payload = [].
If just change this line:
<XAxis dataKey="name" allowDuplicatedCategory={false} />
for this one
<XAxis dataKey="name" allowDuplicatedCategory={true} />
The Tooltip show and payload = [{ color: "#ff7300", dataKey: "count", fill: "#ff7300", formatter: undefined, name: "count", payload: { count: 32, sum: [12, 16] }, type: undefined, unit: undefined, value: 32 }].
What is expected?
The Tooltip should be displayed when hovering over a bar and payload have array with data. http://prntscr.com/w70392
What is actually happening?
Adding allowDuplicatedCategory={false} to XAxis component in BarChart makes the Tooltip stop working. The Tooltip just don't show when hovering over a bar and payload = [];
http://prntscr.com/w6zywz
| Environment | Info |
|---|---|
| Recharts | v1.8.5 |
| React | 16.13.1 |
| System | Windows 10 Home 2004 |
| Browser | Google Chrome (87.0.4280.88) |