pissang opened a new pull request, #16903: URL: https://github.com/apache/echarts/pull/16903
<!-- Please fill in the following information to help us review your PR more efficiently. --> ## Brief Information This pull request is in the type of: - [ ] bug fixing - [x] new feature - [ ] others ### What does this PR do? This PR migrates the aggregate and id transform from https://github.com/100pah/echarts-simple-transform , which is a experiment repo maintained by one of our maintainers @100pah. The API design is mainly keeped same but code are refactored to be more clear and neater. Also in this PR the old `seriesLayoutBy` option is renamed to `sourceLayout` to be more clear. ## Details ### Aggregate transform ```ts const option = { dataset: [{ source: [ ['aa', 'bb', 'cc', 'tag'], [12, 0.33, 5200, 'AA'], [21, 0.65, 7100, 'AA'], [51, 0.15, 1100, 'BB'], [71, 0.75, 9100, 'BB'], ... ] }, { transform: { type: 'aggregate', config: { output: [ // by default, use the same name with `from`. { from: 'aa', method: 'sum' }, { from: 'bb', method: 'count' }, { from: 'cc' }, // method by default: use the first value. { from: 'dd', method: 'Q1' }, { from: 'tag' } ], groupBy: 'tag' } } // Then the result data will be: // [ // ['aa', 'bb', 'cc', 'tag'], // [12, 0.33, 5200, 'AA'], // [21, 0.65, 8100, 'BB'], // ... // ] }], // ... }; ``` ### ID transform ```ts const option = { dataset: [{ source: [ ['aa', 'bb', 'cc', 'tag'], [12, 0.33, 5200, 'AA'], [21, 0.65, 8100, 'AA'], ... ] }, { transform: { type: 'id', config: { dimensionIndex: 4, dimensionName: 'ID' } } // Then the result data will be: // [ // ['aa', 'bb', 'cc', 'tag', 'ID'], // [12, 0.33, 5200, 'AA', 0], // [21, 0.65, 8100, 'BB', 1], // ... // ] }], // ... }; ``` ## Misc <!-- ADD RELATED ISSUE ID WHEN APPLICABLE --> - [x] The API has been changed (apache/echarts-doc#xxx). - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs N.A. ## Others ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information -- 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]
