schizophrenicmaniac opened a new pull request, #21886:
URL: https://github.com/apache/echarts/pull/21886
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
Keeps per-item category axis options (like `textStyle`) when the Data View
is refreshed, the same way series data items are already kept.
### Fixed issues
- Fixes #21881: Data View refresh drops category label textStyle even when
the table is unchanged
## Details
### Before: What was the problem?
The Data View table only holds category names, so `parseContents()` rebuilds
the category axis data as plain strings. The `changeDataView` action merges
series data back into the original items with `tryMergeDataOption`, but it
passes the axis data straight to `mergeOption`. So clicking Refresh, even
without editing anything, turned `{ value: 'Actual', textStyle: { color:
'#cc2244', fontWeight: 'bold' } }` into `'Actual'` and the label lost its style.
### After: How does it behave after the fixing?
In `changeDataView`, the new data for each
`xAxis`/`yAxis`/`angleAxis`/`radiusAxis` in the payload is now also run through
`tryMergeDataOption` against the original data of the axis at the same index.
Refreshing an unchanged table leaves the axis data as it was. If a category
name is edited, the new value is used and the item's other options are kept,
which matches how series items behave.
Added `test/ut/spec/component/toolbox/dataView.test.ts`, which opens the
Data View through the toolbox icon, clicks Refresh and checks
`getOption().xAxis[0].data`, both for an unchanged table and for edited
categories and values.
## 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/toolbox/dataView.test.ts`
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
`npm run checktype`, `npm run lint` and `npm test` pass locally.
--
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]