Skip to content

fix(candlestick): apply canvas-level clipPath in normal rendering mode#21628

Open
wplong11 wants to merge 1 commit into
apache:masterfrom
wplong11:fix/candlestick-normal-clip
Open

fix(candlestick): apply canvas-level clipPath in normal rendering mode#21628
wplong11 wants to merge 1 commit into
apache:masterfrom
wplong11:fix/candlestick-normal-clip

Conversation

@wplong11
Copy link
Copy Markdown

Summary

  • Apply group.setClipPath() in candlestick normal rendering mode when clip: true, consistent with how LineView handles clipping.
  • Previously, CandlestickView.render() unconditionally removed the clip path and relied solely on a per-item isNormalBoxClipped() visibility check, which allowed partially-visible candlestick wicks to render outside the grid boundary.
  • The per-item isNormalBoxClipped check is kept as an optimization to skip items entirely outside the clip area.

Fixes #21627

Changes

src/chart/candlestick/CandlestickView.ts

  1. Removed the unconditional group.removeClipPath() call from render() (previously line 52) — clip path lifecycle is now managed by _renderNormal and _renderLarge individually.
  2. Added canvas-level clip path in _renderNormal(): when clip: true, applies group.setClipPath(createClipPath(coord, false, seriesModel)); otherwise calls group.removeClipPath().

Before / After

Before (v5.5.0) After (this PR)
Candlestick wicks bleed into adjacent grid Wicks clipped at grid boundary

Live reproducer: https://wplong11.github.io/echarts-candlestick-clip-bug/

Test plan

  • Open the reproducer with patched build — wicks should be clipped at Grid 1 boundary
  • Toggle filterMode between 'none' and 'empty' — both should show no bleed
  • Toggle y-axis zoom off — full range should render normally
  • Verify candlestick rendering in single-grid layout is unaffected
  • Verify large mode rendering is unaffected (large mode already applies setClipPath)

## 작업 배경

- CandlestickView normal mode에서 clip:true 설정 시에도 canvas-level clipPath가 적용되지 않아 multi-grid 레이아웃에서 candlestick wick이 인접 grid 영역으로 침범하는 버그

## 작업 내용

- _renderNormal()에서 clip:true일 때 group.setClipPath() 적용 (LineView와 동일한 방식)
- render()에서 무조건 호출하던 group.removeClipPath() 제거 — _renderNormal과 _renderLarge 각각에서 clip 상태에 따라 처리
- 기존 per-item isNormalBoxClipped 검사는 최적화로 유지 (전체 영역 밖 item skip)

Fixes apache#21627
@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented May 25, 2026

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Candlestick series does not clip to grid in multi-grid layout even with clip: true

1 participant