Skip to content

fix(line): handle empty visualMap color stops. close #18066#21666

Open
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-18066-visualmap-null-bound
Open

fix(line): handle empty visualMap color stops. close #18066#21666
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-18066-visualmap-null-bound

Conversation

@rahul37wallst-sudo

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fix line series rendering when a piecewise visualMap piece has a null bound and produces no gradient color stops.

Fixed issues

Details

Before: What was the problem?

When a line series uses a piecewise visualMap with a piece like:

pieces: [{
    lte: null,
    color: '#ff0000'
}]

the visualMap metadata can contain outerColors but no color stops. LineView still tried to read colorStopsInRange[0].coord, causing:

TypeError: Cannot read properties of undefined (reading 'coord')

After: How does it behave after the fixing?

Line series no longer throws for this visualMap configuration.

When there are no in-range color stops, LineView now handles the empty-stop case and returns the available outer color instead of building a gradient from an empty stops array.

A regression test was added for the null-bound piecewise visualMap case.

Validation:

npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/component/visualMap/nullBound.test.ts
npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/component/visualMap/setOption.test.ts test/ut/spec/component/visualMap/nullBound.test.ts
npm run checktype

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

test/ut/spec/component/visualMap/nullBound.test.ts

Merging options

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

Other information

N.A.

@echarts-bot

echarts-bot Bot commented Jun 30, 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.

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.

1 participant