palerdot / react-d3-speedometer

React Speedometer component using d3.js ⚛️
https://palerdot.in/react-d3-speedometer/
MIT License
230 stars 57 forks source link

Add segment click functionality #180

Open sayzard opened 7 months ago

sayzard commented 7 months ago

Retrieve label and range value when clicking on segments

ex) Segment clicked: Awesome! 750-1000

palerdot commented 7 months ago

Please open a new issue explaining the introduction of new prop onSegmentClick.

While the prop name and functionality looks ok, the arguments (and the order) do not. I prefer an object with label, text keys since it is easier to introduce new keys in the future without the hassle of remembering the function argument order.

onSegmentClick({ label, text} )

I can consider this PR, if an issue explaining the PR is opened along with necesssary function argument changes.

I would also prefer a test for the onSegmentClick changes with a mock function.

PS: I cannot guarantee a timeline for integrating this into the main codebase.