[Feature] Native pivot / group-by-column dataset transform for long-format records
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng việc xem xét pipeline filter/sort hiện có của dataset.transform và phần công việc aggregate liên quan được tham chiếu trong #15306 và #16903. Trước tiên, hãy đạt được sự đồng thuận của maintainer về pivot so với API series.groupBy và phạm vi chỉ có một upstream; được xem là hoàn tất khi có một RFC được chấp nhận và hướng triển khai được thống nhất, vì không có tệp hoặc test nào được nêu tên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What problem does this feature solve?
ECharts dataset is strongest when the source is already a pivot table (one row per category, one column per series). A large share of real data — SQL result sets, CSV exports, analytics event logs — arrives in long / tidy / record form instead:
dataset: {
dimensions: ['Country', 'Year', 'Population'],
source: [
['Brazil', 2011, 18203],
['Brazil', 2012, 19325],
['Indonesia', 2011, 23489],
['USA', 2011, 29034]
]
}
There is still no first-class way to turn that into N series (one per Year, or one per Country) without either:
- pre-pivoting outside ECharts, or
- one
filtertransform per distinct group (O(groups × rows)), which does not scale.
This was originally described in #16083 (closed stale; still requested in 2025–2026). @100pah agreed a pivot transformer belongs in the transform pipeline, possibly piped after aggregate.
Built-in filter / sort cannot express this. Third-party echarts-simple-transform only aggregates one groupBy dimension and does not reshape long → wide. Draft PR #16903 migrates aggregate/id into core but does not add pivot / “split into series by column”.
We hit this in production SQL → option pipelines: one query returns tidy rows, several cartesian/polar series need to share that table, and encode cannot invent series from a grouping column.
Related: #15306 (built-in aggregate; still open), #16903 (draft migration, stale).
This is not an alternative to an existing API — it is the missing reshape that makes dataset + encode usable for the format databases actually emit.
What does the proposed API look like?
Keep it a single-upstream dataset.transform, consistent with filter/sort and with @100pah’s note on #16083 (standalone, or piped after aggregate).
1. Split long data into multiple series (the #16083 bar case)
dataset: [
{ id: 'raw', source: /* Country, Year, Population */ },
{
fromDatasetId: 'raw',
transform: {
type: 'pivot', // or 'group'
config: {
row: 'Country',
column: 'Year',
value: 'Population',
fill: 0
}
}
}
]
// result dimensions: Country, 2011, 2012, ...
series: [
{ type: 'bar', encode: { x: 'Population', y: 'Country' } } // plus one series per year via encode, or
]
A companion option for “one series per distinct value of column” (so callers do not have to list years) would close the remaining gap:
series: {
type: 'bar',
datasetId: 'raw',
encode: { x: 'Population', y: 'Country' },
// proposed — not currently valid
groupBy: 'Year'
}
series.groupBy is the better UX for bar/line/scatter; dataset.transform: pivot is the better fit for the existing transform plugin model and for heatmap/treemap that want a wide table. Both can share one implementation.
2. Pipe after aggregate (#15306)
Long data with duplicates first:
dataset: [
{ source: rows },
{ transform: { type: 'aggregate', config: { groupBy: ['Country', 'Year'], output: [{ from: 'Population', method: 'sum' }] } } },
{ transform: { type: 'pivot', config: { row: 'Country', column: 'Year', value: 'Population' } } }
]
3. What this should not try to do
Cross-dataset joins (sankey nodes+edges, heatmap cells+axis catalogs) stay outside this transform — a pivot only sees one upstream dataset, which is the right scope for core. Multi-source composition belongs in application code.
Prior art
- Vega
pivot/fold - Production-validated row/col/value config:
{ from, rowKey, colKey, value, fill } - Community aggregate: https://github.com/100pah/echarts-simple-transform (SUM currently wrong on npm until https://github.com/100pah/echarts-simple-transform/pull/9)
Happy to iterate on names (pivot vs spread vs group) and on whether series-level groupBy is in scope for a first RFC. I am not opening a core PR until there is maintainer agreement on the shape — per the contributing wiki this is RFC-sized, not a drive-by patch.
- Ngôn ngữ chính
- TypeScript
- Star
- 67.7k
- Fork
- 19.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectCó thể đã có người làm @waterWang đã nhận 98 ngày trước. Đang mởbug en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của apache/echarts
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mike-north/AgentMonitors#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/ui#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày