rahul37wallst-sudo opened a new pull request, #21666:
URL: https://github.com/apache/echarts/pull/21666
<!-- Please fill in the following information to help us review your PR more
efficiently. -->
## Brief Information
This pull request is in the type of:
- [x] 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
<!--
- #xxxx: ...
-->
- #18066: Line charts throw when `visualMap.pieces[].lte` is set to `null`.
## Details
### Before: What was the problem?
<!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
When a line series uses a piecewise visualMap with a piece like:
```js
pieces: [{
lte: null,
color: '#ff0000'
}]
```
the visualMap metadata can contain `outerColors` but no color stops.
`LineView` still tried to read `colorStopsInRange[0].coord`, causing:
```text
TypeError: Cannot read properties of undefined (reading 'coord')
```
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
### After: How does it behave after the fixing?
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED.
-->
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:
```sh
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
```
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
## 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.
<!-- PLEASE CHECK IT AGAINST:
<https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors>
-->
### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]