Ayush765-spec commented on issue #21742: URL: https://github.com/apache/echarts/issues/21742#issuecomment-6846865986
Hey @namannitr @helgasoft, I've been looking at this and I think a pivot transform fits really well alongside the existing `filter` and `sort` ones. @100pah, it would be great to get your take on the shape before anyone writes code. The idea is a transform of type `pivot` that reads a single upstream dataset and takes three dimension names: `row`, `column` and `value`, plus an optional `fill` for empty cells. It goes through the upstream rows once. For each row it picks up the row key, the column key and the value, and drops the value into the right cell of a new wide table, while keeping track of every distinct column value it has seen. The output has the row dimension first, followed by one dimension per distinct column value (so for the example above: Country, 2011, 2012). Any cell that never got a value gets the `fill` value, or stays empty. That replaces the current workaround of one filter per group with a single pass over the data, and the result is exactly the shape `encode` already works well with. A few edge cases I'd want to agree on up front. If the same row and column pair shows up more than once, I'd lean towards a clear error rather than silently picking one value, and people who need sums or averages can put an `aggregate` step before the pivot. Columns would keep the order they first appear in, with an optional setting to sort them instead. Numeric column keys like years would become string dimension names so they stay valid. On where it should live, I agree with @helgasoft that starting in `echarts-simple-transform` makes sense. We could get the API settled and tested there, then move it into core later alongside the aggregate work in #16903. The series-level `groupBy` option could come after that and reuse the same logic to create one series per column automatically, so we wouldn't need two separate implementations. If this direction sounds right, I'm happy to put together a first version and share it here for feedback. -- 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]
