Repository navigation
fix(chart): candles with the wick turned off stay visible when zoomed out - #411
Merged
Merged
Conversation
… out Below 3 px per bar a candle is too narrow for a body and paints as one stick. That stick followed the wick setting alone, so a chart with the wick hidden painted nothing between 1 and 3 px per bar. Below 1 px, where bars share pixel columns, the sticks came back and ignored the setting. The stick now stands for the whole candle, in both tiers and both backends: high to low while the wick shows, open to close in the body color (the border's when only the border is on) when it does not, and nothing once the body, border and wick are all off. Co-authored-by: Cursor <cursoragent@cursor.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 59b9dce2-0aeb-46cc-bfec-b6ed7029c441) |
…ow-visibility Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # CHANGELOG.md
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: b22c887a-93df-4381-837b-3f4ec976bdd7) |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Background
A user reported candles disappearing while zooming out with a drag on the time axis, then
coming back when zooming out further. It happened on every symbol and timeframe they tried.
It reproduces on a stock chart with Wick turned off in the candle settings. Below 3 px
per bar a candle is too narrow for a body and paints as one stick, and that stick followed
the wick setting alone:
the setting, in the hidden wick's color.
The gap has been there since the tiers were written. The fixed half-pixel zoom-out limit of
0.10.8 made it easy to reach on any chart, and made the candles come back past it, which is
what reads as a glitch.
Summary
In the two tiers too narrow for a body, the stick now stands for the whole candle and spans
whichever part is still visible. Both backends share one rule:
only the border is on. A doji keeps one device pixel;
Nothing changes for a chart with the wick on, and nothing changes for candles wide enough
to show a body.
One consequence for candle-based plugin chart types that hide their candles through the
per-style visibility keys: those candles no longer come back as sticks below 1 px per bar.
End-to-end verification
The widget playground (BTCUSDT 1h, Binance) in headless Chromium at 1500×900. Wick was
turned off with a real click in Settings → Symbol → Candles, the chart was zoomed with real
mouse drags on the time axis, and candle pixels were counted in a screenshot of the price
pane. The wick was given a color nothing else on the chart uses.
Also checked in the browser:
0.98 px per bar all paint;
Before the change, the same drag was also run on 0.10.7: the pane was already empty at its
zoom-out limit (2.73 px per bar with 500 bars loaded).
Checklist
npm run typecheck,npm run lint,npm test, andnpm run buildall passdocs/has been added / updated (for public interface or feature changes)CHANGELOG.mdhas an entry under[Unreleased](for user-visible changes)Note
Medium Risk
Touches shared native rendering LOD in both primary backends; behavior change is scoped to thin/aggregate tiers but affects all candle visibility settings when zoomed out.
Overview
Fixes candle charts where Wick is off so candles no longer disappear when zoom narrows bars below body width (roughly <3 px per bar).
Thin-candle LOD now treats each stick as the whole candle: shared helpers
candleStickExtentandcandleStickColorincandle-loddecide span (high–low vs open–close) and color from whatever parts are still visible. Canvas2d and WebGL2 both use this for per-bar sticks and aggregated columns; aggregation accepts abodyextent so wick-hidden bars do not reappear in wick colors when zooming further out.Wide candles and wick-on behavior are unchanged; if body, border, and wick are all off, nothing draws at any zoom. Changelog and tests cover LOD helpers, aggregation body extent, and backend parity across zoom tiers.
Reviewed by Cursor Bugbot for commit 02ed675. Bugbot is set up for automated code reviews on this repo. Configure here.