When clicking on a sector in pie chart in recharts library I want the blue rectangle that appears to not appear.
The recharts library is being used in react app.
<PieChart width={800} height={400} onMouseEnter={this.onPieEnter}>
<Pie
data={data}
cx={120}
cy={200}
innerRadius={60}
outerRadius={80}
fill="#8884d8"
paddingAngle={5}
dataKey="value"
>
<Tooltip cursor={{ stroke: 'red', strokeWidth: 2 }} />
{data.map((entry, index) => (
<Cell stroke="5"
style={{
filter: `drop-shadow(0px 0px 5px ${COLORS[index % COLORS.length]}`
}}
key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
))}
</Pie>
<Pie
data={data}
cx={420}
cy={200}
startAngle={180}
endAngle={0}
innerRadius={60}
outerRadius={80}
fill="#8884d8"
paddingAngle={5}
dataKey="value"
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
))}
</Pie>
</PieChart>
You should add outline: none to the Chart element
<PieChart width={800} height={400} onMouseEnter={this.onPieEnter}>
<Pie
data={data}
cx={120}
cy={200}
innerRadius={60}
outerRadius={80}
fill="#8884d8"
paddingAngle={5}
dataKey="value"
>
<Tooltip cursor={{ stroke: "red", strokeWidth: 2 }} />
{data.map((entry, index) => (
<Cell
stroke="5"
style={{
filter: `drop-shadow(0px 0px 5px ${COLORS[index % COLORS.length]}`,
outline: "none",
}}
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))}
</Pie>
<Pie
data={data}
cx={420}
cy={200}
startAngle={180}
endAngle={0}
innerRadius={60}
outerRadius={80}
fill="#8884d8"
paddingAngle={5}
dataKey="value"
>
{data.map((entry, index) => (
<Cell
style={{ outline: "none" }}
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))}
</Pie>
</PieChart>;
You can add outline: none in the <Pie/> Component
<Pie
...
style={{outline: 'none'}}
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With