Skip to content

fix(map): support dataset with seriesLayoutBy row in map series - #21767

Open
jayzhou2309 wants to merge 2 commits into
apache:masterfrom
jayzhou2309:fix/map-series-layout-by-row
Open

jayzhou2309 wants to merge 2 commits into
apache:masterfrom
jayzhou2309:fix/map-series-layout-by-row

Conversation

@jayzhou2309

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Let a map series read a dataset in seriesLayoutBy: 'row', and keep region names when a dataset leaves some regions out.

Fixed issues

Details

Before: What was the problem?

MapSeries.getInitialData adds every GeoJSON region that has no data item by calling data.appendData([{name}, ...]), even when that list is empty. Two dataset cases broke:

  • seriesLayoutBy: 'row': the arrayRows row-layout data provider throws Do not support appendData when set seriesLayoutBy: "row"., so setOption fails.
  • seriesLayoutBy: 'column' (the default): the {name} objects get pushed into the user's dataset.source rows. 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. For series.data (source format original), the code still calls appendData with the {name} items, so GeoJSON properties.echartsStyle still applies to regions missing from the data.

A regression test in test/ut/spec/series/map.test.ts covers both layouts with one region missing from the dataset:

  • Before the fix: 2 of 2 fail. The row test throws the error above. The column test gets {"": NaN} where it expects {C: NaN}.
  • After the fix: 2 of 2 pass.
  • Full unit suite (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 --noEmit and eslint on 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.

  • 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/series/map.test.ts

Merging options

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

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.ts before and after the fix, npm test, npx tsc --noEmit, and npx 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.

jayzhou2309 and others added 2 commits September 29, 2026 02:33
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>
@echarts-bot

echarts-bot Bot commented Sep 28, 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.

This branch has not been deployed

No deployments
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