Skip to content

Conversation

@Justin-ZS
Copy link
Contributor

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

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.

截屏2025-11-18 18 02 57

Fixed issues

N/A

Details

Before: What was the problem?

The traditional radar chart in ECharts has several limitations:

  1. 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.

  2. Implementation Inconsistencies: The radar chart was implemented as a standalone component with its own logic, separate from the polar coordinate system. This resulted in:

    • Many features available in polar line charts being unavailable in radar charts
    • Several unresolved bugs and missing functionality
    • Duplicated code and inconsistent API design
  3. 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 connectEnds option to line series

  • Connects the end point back to the start point, creating a closed shape
  • Only effective in polar coordinate system
  • Works seamlessly with smooth curves (automatically adds control points for smooth closure)
  • Supports both polyline and polygon (with area fill)

2. Added splitLine.shape option to radius axis

  • New option: 'arc' (default, original behavior) or 'polygon'
  • When set to 'polygon' with category angle axis, creates polygon-shaped grid lines by connecting angle tick points
  • Perfectly simulates the radar chart's web-like grid appearance

Benefits:

  • Users can now use polar line charts for single category + single metric scenarios
  • Inherits all line series features: smooth curves, sampling, custom styles, etc.
  • More flexible than the traditional radar chart
  • Consistent with industry standards and other popular charting libraries
  • Unified API design with the rest of ECharts

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

Documentation needed:

  • New connectEnds option for line series in polar coordinate system
  • New splitLine.shape option for radius axis
  • Usage examples showing how to create radar-like charts using enhanced polar line

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

Note: This PR only uses standard canvas drawing APIs for rendering geometry (polygons, lines). No security-sensitive Web APIs are involved.

ZRender Changes

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

Related test cases or examples to use the new APIs

Basic usage example:

const option = {
  polar: { radius: '70%' },
  radiusAxis: {
    type: 'value',
    min: 0,
    max: 10,
    splitLine: {
      show: true,
      shape: 'polygon'  // New option
    }
  },
  angleAxis: {
    type: 'category',
    data: ['A', 'B', 'C', 'D', 'E', 'F'],
    boundaryGap: false,
    startAngle: 90,
    axisLine: {
        show: false
    },
  },
  series: [{
    type: 'line',
    coordinateSystem: 'polar',
    connectEnds: true,  // New option
   data: [[8, 'A'], [6, 'B'], [7, 'C'], [5, 'D'], [8, 'E'], [6, 'F']],
    areaStyle: {}
  }]
};

Merging options

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

Other information

@echarts-bot echarts-bot bot added the PR: awaiting doc Document changes is required for this PR. label Nov 18, 2025
@echarts-bot
Copy link

echarts-bot bot commented Nov 18, 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.

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 PR: awaiting doc label.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

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

@Justin-ZS Justin-ZS force-pushed the feat/polar_line_as_radar branch from b9fc0c5 to 6d55dbf Compare November 21, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: awaiting doc Document changes is required for this PR. size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant