Skip to content

fix(bar): floating bars incorrectly offset by stacked base value#12198

Open
unreal639 wants to merge 1 commit intochartjs:masterfrom
unreal639:patch-1
Open

fix(bar): floating bars incorrectly offset by stacked base value#12198
unreal639 wants to merge 1 commit intochartjs:masterfrom
unreal639:patch-1

Conversation

@unreal639
Copy link

Fixes: #12197
When using floating bars (y: [start, end]) with stacked: true on a linear axis, bars sharing the same x value across multiple datasets are rendered at incorrect positions. The stacked base offset calculated by applyStack is incorrectly added to the absolute coordinates of the floating bar, causing bars to be shifted away from their intended y range.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

floating bars incorrectly offset by stacked base value

1 participant