You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Pie: selected slice x/y offset persists after setOption with fewer data items #21756
Open the JSFiddle link and Run. Ensure ECharts 6.1.0 is loaded (Resources → CDNJS → echarts 6.1.0).
Click 1–2 pie sectors on the chart (not the legend). Slices move outward (selectedMode: 'multiple', selectedOffset: 10).
Click "Apply filter (OLD — no unselect)". This calls setOption with fewer series[0].data items, { notMerge: true }, then resize(), without unselect and without resetting graphic x/y on slices.
Observe the pie layout: fewer slices, series top/bottom may change; chart can look shifted or misaligned.
Current Behavior
After multi-select, selected slice graphic elements keep non-zero x/y translation when setOption replaces the dataset with fewer items (notMerge: true) and resize() is called.
The pie can appear shifted or misaligned relative to the series layout box. This is more visible when layout margins change (e.g. series top/bottom depend on slice count).
dispatchAction({ type: 'unselect', seriesIndex: 0 }) before setOption does not reset those graphic offsets. Resetting each slice graphic with attr({ x: 0, y: 0 }) before setOption fixes the layout.
Expected Behavior
After setOption with a new dataset, the pie is centered and sector positions match the new layout, with no leftover translation from the previous selection state.
Environment
- OS: macOS
- Browser: Chrome (latest)
- Framework: none (plain JS in JSFiddle; same issue observed in production with echarts 6.1.0 and echarts-for-react)
Any additional comments?
Repro flow mirrors a dashboard widget: multi-select pie sectors → filter data → setOption(notMerge) + resize.
Screenshot 1: Multi-select two pie sectors (C and E); slices move outward before filtering.
Screenshot 2: After Apply filter (OLD — no unselect) with 2 slices — selected graphic offset persists; pie looks misaligned / fragmented.
Screenshot 3 shows that Reset in the repro only calls dispatchAction(unselect) and setOption(full data); slices stay offset. Matches our finding that graphic x/y must be reset explicitly.
It seems dataIndex parameter in unselect is mandatory when name is not used. With dataIndex missing, like in your code, it fails silently.
However there is a bug in pie unselect action. An error "Cannot read properties of undefined (reading 'dataIndex')" appears after execution. Demo
This happens in scatter series also, maybe in others too...
Activity
helgasoft commentedon Sep 17, 2026
It seems dataIndex parameter in unselect is mandatory when name is not used. With dataIndex missing, like in your code, it fails silently.
However there is a bug in pie unselect action. An error "Cannot read properties of undefined (reading 'dataIndex')" appears after execution. Demo
This happens in scatter series also, maybe in others too...