FormidableLabs / FormidableLabs/victory

Bars overlapping where expected number of columns not present.

Open
#3,030 2 comments 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

36.6.8

### Code Sandbox link

https://codesandbox.io/p/sandbox/victory-minimum-example-overlapping-bars-forked-3vfxpp?file=%2Fsrc%2FApp.js%3A95%2C1-96%2C1

### Bug report

Given a domain when the set of data provided to VictoryBar contains missing values the chart bars overlap.
In the Code Sandbox (link provided above), you'll be able to toggle between 3 scenarios and see the associated charts:

- Discontinuous data - bars overlap
![Screenshot 2025-01-10 at 1 05 29 PM](https://github.com/user-attachments/assets/d363aabf-46bf-418b-b8d1-68815eefcf49)

- Missing data subbed with zero - bars don't overlap
![Screenshot 2025-01-10 at 1 26 13 PM](https://github.com/user-attachments/assets/fba150fe-a6a7-4591-bc3c-d1bc713c4ff8)

- Full data - bars don't overlap
![Screenshot 2025-01-10 at 1 26 30 PM](https://github.com/user-attachments/assets/57253cac-e509-4de6-8bd1-5701b4219f7d)

### Steps to reproduce

Head to the code sandbox link I provided and toggle between the different scenarios (discontinuous data - bars overlap, missing data subbed with zero - bars don't overlap, full data - bars don't overlap) and see how the bars behave.

### Expected behavior

In the context of a discontinuous set of data provided to VictoryBar the bars don't overlap in the graph.
We expect Victory to calculate and adjust the width of the bars given the dataset and the domain.

### Actual behavior

In the context of a discontinuous set of data provided to VictoryBar the bars overlap in the graph.

### Environment

```markdown
- Device: Desktop
- OS: Sonoma 14.6.1
- Node: v16.17.1
- npm: 8.15.0
```

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.