yqtian-se opened a new issue, #21875:
URL: https://github.com/apache/echarts/issues/21875

   ### Version
   
   6.1.0 (also current master, commit 34f4d92, and 5.6.0)
   
   ### Link to Minimal Reproduction
   
   
https://echarts.apache.org/examples/en/editor.html?code=rVJNb9pAEL37VzzlYiK5hNCiVEY90F5btWqiHII4rO3BjDC7aHdMsBD_PbOGRCTnnDw7bz7ee-ObG8xQGI9yZbzgmWUFg6t7p4-iw840LV0pSOW6cHvIyggCSYAn0whvKFYOk12cwMIU8APz9Cf5hm2aIf3NoXB99MdUnqsY_TOeQwz-uw3F7yOTtSZdTBO3FXZWZxwSoNb6HAc0tJQcdyMcM83uZ3sOMS3dlnKkPcX0hHUfsNII1c53uqQyYvIzxwxsd-SDlohv6dQbyCuUY_7WrbZo46XQHEvTBHqdNv86znD7PcO3SYbxXYbJrb7HCxwXyXGaJGruw4rQ6mgIl-vw0Vjdr7juCTCeEBSkaqhN6jIH0H5LZcwkavmDcnCtDJatLXuTBte9S5vuVzzdUEv-9u4NDpda3tM_yVWC19PkqFxHo5FG74i29kSVBaY2bCMdwvkwSqow5RrieubOc83WNHCWsjilaKUHzv9CENOp12dhWl7pArZByOhridqxrd8mzr48fZ7S_lAXUseTKPUF&enc=deflate
   
   ### Steps to Reproduce
   
   Our bar chart has a "Sort by value" checkbox that sets `realtimeSort` on the 
series. Ticking it sorts the bars as expected. Unticking it should bring back 
the original category order, but the bars stay sorted.
   
   ```js
   var cities = ['Berlin', 'Lisbon', 'Madrid', 'Paris', 'Rome', 'Vienna'];
   option = {
     grid: { left: 70 },
     xAxis: { type: 'value' },
     yAxis: { type: 'category', data: cities, inverse: true },
     series: [{ type: 'bar', realtimeSort: false, data: [32, 18, 45, 27, 51, 
12] }]
   };
   setTimeout(function () {
     myChart.setOption({ series: [{ realtimeSort: true }] });
   }, 1000);
   setTimeout(function () {
     myChart.setOption({ series: [{ realtimeSort: false }] });
   }, 2500);
   ```
   
   The same with four bars and nothing else:
   
   ```js
   option = {
     xAxis: { type: 'category', data: ['a', 'b', 'c', 'd'] },
     yAxis: { type: 'value' },
     series: [{ type: 'bar', realtimeSort: false, data: [10, 40, 20, 30] }]
   };
   setTimeout(function () {
     myChart.setOption({ series: [{ realtimeSort: true }] });
   }, 1000);
   setTimeout(function () {
     myChart.setOption({ series: [{ realtimeSort: false }] });
   }, 2000);
   ```
   
   <img width="810" height="300" alt="browser-canvas-master" 
src="https://github.com/user-attachments/assets/1e96f2c3-38c7-4265-9a8a-f02e4b412b09";
 />
   
   ### Current Behavior
   
   After the checkbox is unticked the option is the same as at the start, but 
the axis keeps the sorted order. A chart created with this option shows the 
original order. Other series on the same category axis are then drawn against 
the sorted order as well.
   
   ### Expected Behavior
   
   I expected turning `realtimeSort` off to go back to the data order, as in a 
chart created directly with `realtimeSort: false`. 
   
   ### Environment
   
   ```markdown
   - OS: Linux 5.15 x86_64
   - Browser: Chromium 141.0.7390.37
   - Framework: none
   - Renderer: canvas and SVG
   ```
   
   ### Any additional comments?
   
   `Axis2D.setCategorySortInfo` stores the sort in the axis model's option 
(`this.model.option.categorySortInfo = info`), and the grid applies 
`axis.model.get('categorySortInfo')` to the scale on every update. Nothing 
clears it when no bar series on that axis uses `realtimeSort` any more.


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