Comments (4)
you can set custom tooltip or default tooltip.
const PieChart = ({
data,
colors,
fill,
dataKey,
innerRadius,
outerRadius,
cx,
cy,
paddingAngle,
label,
labelLine,
payload,
}) => {
const CustomTooltip = ({ payload }) => {
return (
<div>
<div className="ant-popover-arrow" />
<div className={s.customTooltip}>
<b>{payload?.[0]?.payload?.name}</b>
<span className={s.info}>
<p className="desc">
<small>{payload?.[0]?.payload?.totalCurrentPrice}</small>
</p>
<p>{payload?.[0]?.payload?.profitInPercentage} %</p>
</span>
</div>
</div>
);
};
return (
<Chart width={150} height={150}>
<Pie
data={data}
cx={cx}
cy={cy}
innerRadius={innerRadius}
outerRadius={outerRadius}
fill={fill}
paddingAngle={paddingAngle}
dataKey={dataKey}
labelLine={labelLine}
label={label}
>
{data.map((entry, index) => (
<Cell key={entry.key} fill={colors[index % colors.length]} />
))}
</Pie>
<Tooltip content={<CustomTooltip />} />
</Chart>
);
};
if you omit content props in Tooltip, rechart default tooltip will be applied.
from recharts.
Have implemented In v0.7.0
http://recharts.org/examples#TwoSimplePieChart
from recharts.
Awesome, thanks!
from recharts.
There is no tooltip in that example
from recharts.
Related Issues (20)
- Stacked chart round some bars HOT 2
- Points property not generating for Area Chart in v2.12.6 HOT 5
- recharts responsive pie chart with legend HOT 2
- BarChart dataKeys that include brackets don't work HOT 5
- Warning about defaultProps Support in XAxis HOT 3
- Area Chart + Brush: Descending data is reversed on brush HOT 9
- responsive container infers the parent div height [low priority] HOT 1
- Storybook Documentation for more visibility HOT 2
- How to make hover tooltip for each individual cell instead of XAxis column HOT 8
- X-axis times ticks are not display major hour like 11:00 12:00 HOT 9
- Auto rotate X-Axis Tick labels when the chart gets smaller HOT 3
- How to apply gradient on the opposite side of the AreaChart line HOT 2
- 3.0 Bug: Brush internal state
- Tooltip and Legend payload sorting
- Move chart synchronisation to Redux HOT 1
- Move Tooltip state to Redux
- Refactor getComposedData
- Remove Customized component HOT 1
- Export and document hooks
- Support React 19 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recharts.