-
Notifications
You must be signed in to change notification settings - Fork 12k
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