fix: Add SVG decal backgroundColor support
Brief Information
This pull request is in the type of:
- [x] 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
- #21333
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.
- [x] 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
- [x] 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.
https://github.com/user-attachments/assets/1de1686b-8556-4fdc-8242-7380553b7e36
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 changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21337@0c09b6b
The result of
bar-chart-decal-testrunning 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
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
@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
@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 -->
Piechart Test -->
Comple Test -->