Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/PieChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,12 @@ export const PieChart = (props: PieChartPropsType) => {
setTouchY={setTouchY}
tooltipSelectedIndex={tooltipSelectedIndex}
setTooltipSelectedIndex={setTooltipSelectedIndex}
data={[
{
...props.data[selectedIndex],
},
{
value: total - props.data[selectedIndex].value,
peripheral: true,
strokeWidth: 0,
},
]}
data={props.data.map((section, index) => ({
...section,
strokeWidth: index === selectedIndex ? undefined : section.strokeWidth,
peripheral: index !== selectedIndex,
}))}
radius={radius + extraRadius}
initialAngle={startAngle}
innerRadius={props.innerRadius || radius / 2.5}
isBiggerPie
setSelectedIndex={setSelectedIndex}
Expand Down
3 changes: 1 addition & 2 deletions src/PieChart/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ export const PieChartMain = (props: PieChartMainProps) => {
) : (
data.map((item, index) => {
const {sx, sy, ax, ay} = coordinates[index];
if (isBiggerPie && index) return null;
return (
<Path
key={index + 'a'}
Expand Down Expand Up @@ -235,7 +234,7 @@ export const PieChartMain = (props: PieChartMainProps) => {
item.pieInnerComponent ?? props.pieInnerComponent;
const pieInnerComponentHeight = props.pieInnerComponentHeight ?? 0
const pieInnerComponentWidth = props.pieInnerComponentWidth ?? 0
if (isBiggerPie && index) return null;
if (isBiggerPie && index !== props.selectedIndex) return null;
if (!props.data[index].value) return null;
let mx =
cx * (1 + Math.sin(2 * pi * mData[index] + initialAngle));
Expand Down