-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
PolarRadiusAxis inside RadarChart uses wrong type for ticks prop #4668
Description
Do you want to request a feature or report a bug?
report a bug
What is the current behavior?
The published type for the ticks prop of PolarRadiusAxis is TickItem[]. If however I have a polar radius axis inside a radar chart and I pass it ticks of that type, the axis does not render.
The axis will render if I pass in an array of numbers for the tick coordinates.
Either the published type is wrong, or the code is incorrectly expecting numbers.
in my own code I am having to do
ticks={[100 / 3, 200 / 3, 100] as unknown as TickItem[]} to avoid a type error
If the current behavior is a bug, please provide the steps to reproduce
Codesandbox is here:
https://codesandbox.io/p/sandbox/simple-radar-chart-forked-72cg66
if ticks is passed in as an array of TickItems, the grid lines and ticks do not appear.
if you click the checkbox to change the tick type to just numbers, the axis and grid lines appear
you can see the type error in the ticks prop, where it doesn't allow an array of numbers. However only an array of numbers works
What is the expected behavior?
I would expect the polar radius calculation to work when TickItems are used for the ticks parameter (I.E objects with a coordinate attribute)
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
2.12.7 (latest version). No idea when problem was introduced