Motorhead-xXx opened a new issue, #21756:
URL: https://github.com/apache/echarts/issues/21756

   ### Version
   
   6.1.0
   
   ### Link to Minimal Reproduction
   
   https://jsfiddle.net/ma_ss_ai/0kozdxfy/5/
   
   ### Steps to Reproduce
   
   1. Open the JSFiddle link and Run. Ensure ECharts 6.1.0 is loaded (Resources 
→ CDNJS → echarts 6.1.0).
   2. Click 1–2 pie sectors on the chart (not the legend). Slices move outward 
(selectedMode: 'multiple', selectedOffset: 10).
   3. 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.
   4. 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
   
   ```markdown
   - 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.
   
   Workaround used in our application:
   
   chart.dispatchAction({ type: 'unselect', seriesIndex: 'all' }, { flush: true 
});
   chart.getModel().getSeries().forEach((series) => {
     series.getData().eachItemGraphicEl((el) => el?.attr({ x: 0, y: 0 }));
   });
   chart.setOption(newOption, { notMerge: true });
   chart.resize();
   
   
   Screenshot 1: Multi-select two pie sectors (C and E); slices move outward 
before filtering.
   
   <img width="974" height="676" alt="Image" 
src="https://github.com/user-attachments/assets/707a9c56-d3e8-4e82-bdba-7d8cfc9d5ac7";
 />
   
   Screenshot 2: After Apply filter (OLD — no unselect) with 2 slices — 
selected graphic offset persists; pie looks misaligned / fragmented.
   
   <img width="974" height="676" alt="Image" 
src="https://github.com/user-attachments/assets/e5792012-bd97-4a48-81ef-8296f93503b9";
 />
   
   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.
   
   <img width="974" height="676" alt="Image" 
src="https://github.com/user-attachments/assets/8cad6ebc-01aa-4043-bf7e-d6f4a6893ba0";
 />
   
   


-- 
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]

Reply via email to