Skip to content

Conversation

@Srajan-Sanjay-Saxena
Copy link
Contributor

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fixes the issue where decal background color was not applied when the rendering mode was set to SVG.

Fixed issues

Details

Before: What was the problem?

When rendering charts in SVG mode, the decal background color was not visible.
This occurred because the existing code only handled the Canvas rendering case and did not include logic for SVG rendering.

After: How does it behave after the fixing?

The decal background color now correctly appears when charts are rendered in SVG mode.
A separate code path was introduced to handle the non-canvas (SVG) case, utilizing the pattern sizes to generate appropriate SVG dimensions for decal rendering.

Two new test files have been added inside:

test/decal_bg_svg_testing/

to validate the fix in SVG rendering scenarios.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

Two new test cases added in test/decal_bg_svg_testing/.

Merging options

  • Please squash the commits into a single one when merging.

Other information

This fix ensures parity between Canvas and SVG rendering modes regarding decal background color rendering.

2025-11-03.16-09-34.mp4

- Fix decal backgroundColor not working in SVG renderer
- Add background rectangle to SVG patterns when backgroundColor is specified
- Add comprehensive test cases for verification
- Update gitignore to exclude dist folder

Fixes issue where decal backgroundColor was ignored in SVG mode while working correctly in Canvas mode.
@echarts-bot
Copy link

echarts-bot bot commented Nov 3, 2025

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.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

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

Copy link
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.

The result of bar-chart-decal-test running with canvas and svg are not the same. Is this expected? I believe the canvas result is correct.

Please don't create a directory for related tests. You can put them in a single file called decal-backgroundColor.html.

.gitignore Outdated
*.asm

# Distribution files
/dist/
Copy link
Contributor

Choose a reason for hiding this comment

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

/dist should be uploaded when a new version release, so please revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

recitfied in 1b15177

"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.3.4.tgz",
"integrity": "sha512-jRsuseXBo9pN197KnDwhhaaBzyZr2oIcLHHTt2oDdQrej5Qp57dCCJafWx5ivU8/alEYDpssYqv1MUqcxwQlrA==",
"dev": true,
"peer": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't upload the changes of package-lock.json.

@Srajan-Sanjay-Saxena
Copy link
Contributor Author

Srajan-Sanjay-Saxena commented Nov 7, 2025

The result of bar-chart-decal-test running with canvas and svg are not the same. Is this expected? I believe the canvas result is correct.

Please don't create a directory for related tests. You can put them in a single file called decal-backgroundColor.html.

there is one serious issue i found
image
look carefully at the image ... you will find out that the series2 in the bar charts which are the smaller bars are rendered wrongly in svg mode .. the full rendering is shown here .. when the bg is setted to transparent there is an issue with decal
image
@Ovilia assign this task to me i am working on it .... so this is a different issue , i guess we should raise a different ticket because currently the issue was only regarding the bg color although canvas mode is working extremely fine . I reckon that there are some changes that need to be made in zrender .
I am also attaching the canvas test for the same as a reference
image

-fix: removed the nested decal test folder and merged test files into one
@Srajan-Sanjay-Saxena
Copy link
Contributor Author

@Ovilia There is one very interesting thing i found out when i ran the testcase 'test/decal-backgroundColor.html' ... i am attaching the iamges

--> The thing is that there is only an issue with bar chart series2 rendering and only when the color is setted to transparent, all other charts are rendering fine

Barchart Test -->
image

Piechart Test -->
image

Comple Test -->
image

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.

2 participants