FormidableLabs / FormidableLabs/victory

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

Open
#2,881 1 comment 1 reaction 0 assignees View on GitHub
Issue: Accepted Type: Bug :bug:
Dominant language
TypeScript
Stars
11.2k
Forks
536
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Victory version

Latest

### Code Sandbox link

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

### Bug report

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

### Steps to reproduce

```markdown
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

```markdown
It should sort the data by specified `sortKey`
```

### Actual behavior

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

### Environment

```markdown
- Device:
- OS:
- Node:
- npm:
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.