floating bars incorrectly offset by stacked base value
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
### Expected behavior
Floating bars should be rendered at their absolute y coordinates regardless of the stacked configuration. Since a floating bar already encodes both its start and end position explicitly, it should not be offset by the cumulative stack value of other datasets.
### Current behavior
When using floating bars (`y: [start, end]`) with `stacked: true` on a linear axis, some datasets are not rendered at all when multiple datasets share the same x value. This happens because the stacked base offset calculated by `applyStack` is incorrectly added to the absolute coordinates of the floating bar, pushing affected bars outside the visible scale range.
### Reproducible sample
https://jsfiddle.net/g9kLhmbe/2/
### Optional extra steps/info to reproduce
_No response_
### Possible solution
Add a `floatingBarMode` option at the dataset level to distinguish between absolute and relative positioning of floating bars.
`'absolute'`: the floating bar is rendered at its exact `[start, end]` coordinates, ignoring any stacked offset.
`'relative'`: the floating bar is offset by the cumulative stack value of preceding datasets, preserving the current behavior.
To avoid a breaking change, `floatingBarMode` could default to `'relative'` to preserve existing behavior.
### Context
_No response_
### chart.js version
v4.5.1
### Browser name and version
_No response_
### Link to your project
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.