-
Notifications
You must be signed in to change notification settings - Fork 19.8k
feat: enhance polar line to simulate radar #21378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution! 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. Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the |
|
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21378@b4ed481 |
b9fc0c5 to
6d55dbf
Compare
Ovilia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
Would it be better to implement this as a new custom series in echarts-custom-series and only add splitLine.shape in this PR? Using a line series to simulate a radar chart seems like a workaround. Also, since the line series is a commonly used chart type, we should be cautious about both the additional logic and the impact on bundle size.
It looks like you may need to remove shape: 'polygon' in the test case above and test the default value.
Re: custom series — The goal here is to extend and reuse polar line capabilities,not as a workaround. For Re: line series changes — Agreed on being cautious. That's why only two options are added ( Re: bundle size — The actual delta is ~150 lines across 5 files. the size changing is minimal. Re: default value test — Fixed |

Brief Information
This pull request is in the type of:
What does this PR do?
Enhances polar coordinate system to enable line series to simulate radar chart functionality with single category + single metric use cases.
Fixed issues
N/A
Details
Before: What was the problem?
The traditional radar chart in ECharts has several limitations:
Limited Data Structure Support: The original radar chart only works well with multiple metrics + single category structure. When dealing with single metric + single category data (which is common), it becomes difficult to use effectively.
Implementation Inconsistencies: The radar chart was implemented as a standalone component with its own logic, separate from the polar coordinate system. This resulted in:
Industry Standard Mismatch: Most other charting libraries implement radar charts as an extension of polar line charts, which provides better flexibility and feature consistency. ECharts lacked the necessary features to support this approach.
After: How does it behave after the fixing?
This PR enhances the polar coordinate system with two new features that enable line series to simulate radar chart behavior:
1. Added
connectEndsoption to line series2. Added
splitLine.shapeoption to radius axis'arc'(default, original behavior) or'polygon''polygon'with category angle axis, creates polygon-shaped grid lines by connecting angle tick pointsBenefits:
Document Info
One of the following should be checked.
Documentation needed:
connectEndsoption for line series in polar coordinate systemsplitLine.shapeoption for radius axisMisc
Security Checking
Note: This PR only uses standard canvas drawing APIs for rendering geometry (polygons, lines). No security-sensitive Web APIs are involved.
ZRender Changes
Related test cases or examples to use the new APIs
Basic usage example:
Merging options
Other information