Skip to content

[codex] Fix empty heatmap cells leaking splitArea background#21574

Draft
susiwen8 wants to merge 2 commits intomasterfrom
codex/issue-21290-heatmap-empty
Draft

[codex] Fix empty heatmap cells leaking splitArea background#21574
susiwen8 wants to merge 2 commits intomasterfrom
codex/issue-21290-heatmap-empty

Conversation

@susiwen8
Copy link
Copy Markdown
Contributor

@susiwen8 susiwen8 commented Apr 9, 2026

Summary

  • render placeholder heatmap cells for empty values so splitArea bands do not leak through and create inconsistent empty-cell backgrounds
  • add a regression test covering the empty heatmap splitArea behavior

Root Cause

Empty heatmap cells on cartesian-style heatmaps were skipped entirely. With splitArea enabled, the alternating axis background showed through those skipped cells, so adjacent empty cells could appear inconsistent.

Validation

  • ./node_modules/.bin/jest --config test/ut/jest.config.cjs --runInBand test/ut/spec/series/heatmap.test.ts
  • ./node_modules/.bin/eslint src/chart/heatmap/HeatmapView.ts test/ut/spec/series/heatmap.test.ts

Fixes #21290

@echarts-bot
Copy link
Copy Markdown

echarts-bot bot commented Apr 9, 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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes inconsistent rendering of empty heatmap cells when splitArea is enabled by ensuring “empty” data points still produce placeholder rects (so axis split-area bands don’t show through), and adds a regression test to lock in the behavior.

Changes:

  • Render placeholder heatmap rects for empty (NaN) values in cartesian and matrix coordinate systems, using the chart background color (fallback tokens.color.neutral00) as the fill.
  • Update progressive rendering path to apply the same empty-cell fill behavior.
  • Add a Jest regression test verifying empty cells are rendered and filled to prevent splitArea background leakage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/chart/heatmap/HeatmapView.ts Stops skipping empty values on cartesian/matrix heatmaps; renders placeholder rects with a background fill to prevent splitArea bleed-through (including in incremental rendering).
test/ut/spec/series/heatmap.test.ts Adds regression coverage to ensure empty heatmap cells render as rects and use the expected fill, preventing split-area background leakage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21574@adb71c1

@susiwen8 susiwen8 marked this pull request as ready for review April 9, 2026 03:00
@susiwen8 susiwen8 requested review from 100pah and Ovilia April 9, 2026 03:01
Copy link
Copy Markdown
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please provide a screenshot of the colors before and after the change?

this.group.removeAll();

const coordSys = seriesModel.coordinateSystem;
const emptyCellFill: ZRColor = ecModel.get('backgroundColor') || tokens.color.neutral00;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably use tokens.color.background instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in adb71c1 to use tokens.color.background as the fallback instead of tokens.color.neutral00.

@susiwen8
Copy link
Copy Markdown
Contributor Author

Updated the fallback color in . I also re-ran the case locally with a high-contrast \ palette and a yellow chart background to make the visual difference obvious: before the fix, the empty cells showed the split-area colors directly; after the fix, the empty cells use the chart background instead.

@susiwen8
Copy link
Copy Markdown
Contributor Author

Updated the fallback color in adb71c1.

I also re-ran the case locally with a high-contrast splitArea.areaStyle.color palette and a yellow chart background to make the visual difference obvious:

  • before the fix, the empty cells showed the split-area colors directly
  • after the fix, the empty cells use the chart background instead

@susiwen8 susiwen8 marked this pull request as draft April 10, 2026 02:17
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] 热力图对于空数据的表现不一致

3 participants