Skip to content

feat(line): add monotone cubic Hermite smoothing - #21794

Open
awtaylor wants to merge 4 commits into
apache:masterfrom
awtaylor:fix-21793
Open

awtaylor wants to merge 4 commits into
apache:masterfrom
awtaylor:fix-21793

Conversation

@awtaylor

@awtaylor awtaylor commented Oct 19, 2026 •

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others
  • [ ]

What does this PR do?

Add an opt-in monotone cubic Hermite smoother for cartesian line and area series.

Fixed issues

Details

Before: What was the problem?

smooth: true can bow past the samples. smoothMonotone: 'x' and 'y' avoid that by flattening the tangent at every sample, which draws a saddle or plateau at each knot (#21532, #7158).

before-bezier before-flat-tangent

After: How does it behave after the fixing?

smoothMonotone: 'monotoneX' and 'monotoneY' use Fritsch–Butland tangents, so the curve passes through the samples without adding extrema between them. smooth: true is full strength in this mode; a number in (0, 1] scales the tangents. The default and the existing 'x', 'y', and 'none' modes are unchanged. On polar series the new values fall back to the current Bézier smooth.

after-monotone-x

Document Info

  • 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

  • test/ut/spec/chart/line/monotoneCubic.test.ts
  • test/line-monotone.html

Merging options

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

Other information

Interior slopes are Fritsch–Butland (1984), inside the Fritsch–Carlson monotone region (1980). Steffen (1990) is the d3/Vega alternative and can replace the tangent function without an API change if that look is preferred.

@echarts-bot echarts-bot Bot added PR: awaiting doc Document changes is required for this PR. PR: awaiting review labels Oct 19, 2026
@echarts-bot

echarts-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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. PR: awaiting review size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant