FormidableLabs / victory

A collection of composable React components for building interactive data visualizations
http://commerce.nearform.com/open-source/victory/
Other
10.97k stars 526 forks source link

Sorting doesn't work if data for both axis is numeric #2881

Open kazimirchuk opened 3 months ago

kazimirchuk commented 3 months ago

Is there an existing issue for this?

Code of Conduct

Victory version

Latest

Code Sandbox link

https://codesandbox.io/s/victory-starter-forked-l73jld?file=/src/App.tsx

Bug report

Sorting doesn't work if data for both axis is numeric.

Steps to reproduce

1. Go to a "Getting Started" page of Victory
2. Go to Step #3 "Add your data"
3. Confirm that chart data that you see follows this `interface { earnings: number; quarter: number }`
4. Try adding an attribute `sortKey` with the value of `earnings` to the `VictoryBar`
5. Confirm that it doesn't sort
6. Now edit chart data so that it follows this `interface { earnings: number; quarter: string }`
7. Confirm that it started sorting

Expected behavior

It should sort the data by specified `sortKey`

Actual behavior

It doesn't sort the data by specified `sortKey`

Environment

- Device:
- OS:
- Node:
- npm:
kazimirchuk commented 3 months ago

https://github.com/FormidableLabs/victory/assets/8057124/8f56a217-a58f-460e-9c48-e5e681e91510