rahul37wallst-sudo opened a new pull request, #21699:
URL: https://github.com/apache/echarts/pull/21699
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
Collects dimensions from all object-row dataset entries so sparse fields
referenced by `series.encode` map to the correct data.
### Fixed issues
- #11322: Bar charts can use the wrong dataset dimension when a property is
absent from the first object row.
## Details
### Before: What was the problem?
ECharts detected object-row dataset dimensions using only the first
non-empty object.
For data such as:
```js
dataset: {
source: [
{ timestamp: 1568191020000, ECM: 26311.466666666667 },
{
timestamp: 1568191140000,
ECM: 1666775.3333333333,
GSWY: 1332.5333333333333
}
]
}
```
the `GSWY` dimension was not detected because it was absent from the first
row.
Consequently, a bar series configured with:
```js
encode: {
x: 'timestamp',
y: 'GSWY'
}
```
could silently map its y-axis data to another detected dimension, such as
`ECM`, and render incorrect values.
### After: How does it behave after the fixing?
Object-row dimension detection now collects each unique property across all
rows while preserving first-seen order.
As a result, `GSWY` is registered as a dataset dimension even when it is
absent from earlier rows. The corresponding series correctly maps its y-axis
data to `GSWY`; rows without that property remain empty instead of using values
from another dimension.
Regression tests cover both source dimension detection and the stacked bar
chart behavior from the issue.
## 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.
### ZRender Changes
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
Regression coverage was added in:
- `test/ut/spec/data/SeriesData.test.ts`
- `test/ut/spec/series/bar.test.ts`
### Merging options
- [x] Please squash the commits into a single one when merging.
### Other information
Validated with:
```sh
npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand
--runTestsByPath test/ut/spec/data/SeriesData.test.ts
test/ut/spec/series/bar.test.ts
npx eslint src/data/Source.ts test/ut/spec/data/SeriesData.test.ts
test/ut/spec/series/bar.test.ts
npm run checktype
npm run lint
git diff --check
```
--
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]