fix: y-axis widget loses height after axis type override + indicator removal#803
Merged
liihuu merged 1 commit intoJul 9, 2026
Conversation
Recreating an axis (e.g. `overrideYAxis({ name })` switching axis type)
destroys the old widget and creates a new one with zero bounding. The
follow-up layout triggered by `overrideYAxis` only measures width, so the
new widget keeps height 0 until an unrelated `measureHeight` layout (such
as a resize) happens. In the meantime value-to-pixel conversion collapses:
bars are squashed into a single line and axis ticks disappear.
Reproduction: create an indicator bound to a custom y-axis on candle_pane,
call `overrideYAxis({ paneId: candle_pane, name: percentage })`, switch
back to normal, then remove the indicator.
Fix: when a new y-axis widget is created, inherit the pane current
height/top so it stays consistent with the pane geometry; width is still
handled by the subsequent measure-width layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Recreating a y-axis (e.g.
overrideYAxis({ name: 'percentage' })to switch axistype) destroys the old axis widget and creates a fresh one with zero bounding.
The layout triggered by
overrideYAxisonly measures width, so the new widgetkeeps
height: 0until an unrelatedmeasureHeightlayout (such as a containerresize) happens to run. While in that state, value-to-pixel conversion collapses:
candles are squashed into a single line at the pane edge and axis ticks disappear.
Reproduction
createIndicator(ind, { isStack: true, pane: { id: 'candle_pane' }, yAxis: { id: 'my_axis', position: 'left' } })overrideYAxis({ paneId: 'candle_pane', name: 'percentage' })overrideYAxis({ paneId: 'candle_pane', name: 'normal' })removeIndicator({ paneId: 'candle_pane', name: ... })→ candle pane collapses (
getSize('candle_pane', 'yAxis').height === 0).Verified on 10.0.0-beta3 and current main.
Fix
When
DrawPane.createYAxiscreates a new axis widget, inherit the pane's currentheight/topso the widget stays consistent with pane geometry. Width is stillhandled by the subsequent measure-width layout, unchanged.
After the fix the same sequence keeps the axis widget at the pane height and the
chart renders correctly (also verified with percentage → logarithm → normal
switches before removal).
pnpm type-checkpasses.