Skip to content

fix(chart): candles with the wick turned off stay visible when zoomed out - #411

Merged
alexgrover merged 2 commits into
devfrom
fix/candle-sticks-follow-visibility
Nov 17, 2026
Merged

alexgrover merged 2 commits into
devfrom
fix/candle-sticks-follow-visibility

Conversation

@alexgrover

@alexgrover alexgrover commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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:

  • between 1 and 3 px per bar, a hidden wick left nothing to paint, so the pane emptied;
  • below 1 px per bar, where bars share pixel columns, the sticks painted without reading
    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:

  • wick on: high to low in the wick color, as before;
  • wick off, body or border on: open to close, in the body color, or the border's color when
    only the border is on. A doji keeps one device pixel;
  • body, border and wick all off: nothing paints at any zoom.

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.

Bar spacing Candle pixels in the down color Pixels in the hidden wick's color
2.0 px 0 → 2,139 0 → 0
1.2 px 0 → 2,139 0 → 0
0.75 px 0 → 2,035 6,573 → 0

Also checked in the browser:

  • either side of both thresholds at a device pixel ratio of 2: 3.02, 2.98, 1.02 and
    0.98 px per bar all paint;
  • the canvas2d fallback (no WebGL2 context) paints the same way;
  • hollow candles with the wick off keep their border color through every zoom;
  • with every part off, no zoom paints the candles;
  • with the wick on, the counts match the run before the change.

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

  • This PR does one thing (one fix, one feature, one refactor, or one docs change)
  • npm run typecheck, npm run lint, npm test, and npm run build all pass
  • Tests have been added / updated (for bug fixes / features)
  • Documentation in docs/ has been added / updated (for public interface or feature changes)
  • CHANGELOG.md has an entry under [Unreleased] (for user-visible changes)
  • I have signed the CLA (the bot asks in this PR)
  • I have reviewed this pull request myself (self-review)

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 candleStickExtent and candleStickColor in candle-lod decide 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 a body extent 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.

… 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>
@cursor

cursor Bot commented Nov 17, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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
@cursor

cursor Bot commented Nov 17, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@alexgrover
alexgrover merged commit 4b68971 into dev Nov 17, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant