fix(map): support dataset with seriesLayoutBy row in map series - #21767
Open
jayzhou2309 wants to merge 2 commits into
Open
jayzhou2309 wants to merge 2 commits into
jayzhou2309 wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…apache#21520 MapSeries completed its data with regions missing from it by appending {name} items to the data provider. A dataset with seriesLayoutBy 'row' throws on any append, and an arrayRows dataset in column layout read the appended objects as rows, so those regions lost their names. Append only names to the store for dataset sources and keep the item append for series.data, which carries GeoJSON echartsStyle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for your contribution! 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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Information
This pull request is in the type of:
What does this PR do?
Let a map series read a
datasetinseriesLayoutBy: 'row', and keep region names when a dataset leaves some regions out.Fixed issues
Details
Before: What was the problem?
MapSeries.getInitialDataadds every GeoJSON region that has no data item by callingdata.appendData([{name}, ...]), even when that list is empty. Two dataset cases broke:seriesLayoutBy: 'row': thearrayRowsrow-layout data provider throwsDo not support appendData when set seriesLayoutBy: "row"., sosetOptionfails.seriesLayoutBy: 'column'(the default): the{name}objects get pushed into the user'sdataset.sourcerows. The name is then read from index 0 of an object, so every missing region gets the name'', and the dataset array is mutated.After: How does it behave after the fixing?
For a dataset source, the missing regions go to the store with
data.appendValues([], names), which adds the names without touching the data provider. Forseries.data(source formatoriginal), the code still callsappendDatawith the{name}items, so GeoJSONproperties.echartsStylestill applies to regions missing from the data.A regression test in
test/ut/spec/series/map.test.tscovers both layouts with one region missing from the dataset:{"": NaN}where it expects{C: NaN}.npm test): 195 of 196 pass. The one failure,util/time › roundTime_locale, depends on the machine's locale and fails the same way without this change.npx tsc --noEmitandeslinton the changed files are clean.Not verified: rendering in a browser. The test checks the series data (names and values), which the map view and tooltip read.
Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/ut/spec/series/map.test.tsMerging options
Other information
AI disclosure
An AI agent (Claude Code) reproduced this issue, wrote the fix and the test, and ran these checks:
npx jest --config test/ut/jest.config.cjs test/ut/spec/series/map.test.tsbefore and after the fix,npm test,npx tsc --noEmit, andnpx eslint src/chart/map/MapSeries.ts test/ut/spec/series/map.test.ts.🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309.