Skip to content

Commit 1ccef6d

Browse files
author
Robert Crocker
committed
Updated cursor position detection in the Arc component to inform the tooltip.
1 parent f8af7ea commit 1ccef6d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ function App() {
2020
data={fruit.sort((a, b) => a.value - b.value)}
2121
label="label"
2222
value="value"
23-
legend="top-left"
24-
outerRadius={240}
23+
outerRadius={400}
2524
pieLabel={true}
2625
/>
2726
<BarChart

src/components/Arc.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const Arc = React.memo(
2929
cursorX: e.nativeEvent.pageX,
3030
cursorY: e.nativeEvent.pageY,
3131
distanceFromTop: e.nativeEvent.pageY - e.clientY + e.clientY,
32-
distanceFromRight: margin.left + cWidth + margin.right - cWidth,
32+
distanceFromRight:
33+
cWidth - (margin.right + margin.left) - e.nativeEvent.pageX,
3334
distanceFromLeft: e.pageX,
3435
data,
3536
};

0 commit comments

Comments
 (0)