hks2002 commented on issue #17455:
URL: https://github.com/apache/echarts/issues/17455#issuecomment-2440136488

   对数据进行正常排序(前后端均可), 然后将json数组里面的每一个json对象作为一个序列, Sorted the data first! then 
set each json object as a serial.
   ```
       forEach(dataBySite[site], (json) => {
         dataset.push({ source: [json] })
         series.push({
           name: json['NCCAT'],
           type: 'bar',
           datasetIndex: dataset.length - 1,
           xAxisIndex: 0,
           yAxisIndex: 0,
           label: {
             show: true,
             position: 'bottom',
             formatter: '{@PCT}'
           },
           emphasis: {
             focus: 'series'
           },
           tooltip: {
             trigger: 'item',
             formatter: multiLineFormatter
           },
           encode: {
             x: 'target',
             y: 'PCT'
           },
           stack: site,
           label: {
             show: true,
             verticalAlign: 'middle',
             position: '',
             formatter: '{@catCnt}'
           }
         })
       })
   ```
   关键代码core code:
   此例中原始数据进行了分组,按分组进行堆叠。
   ```
   forEach(dataBySite[site], (json) => {
         dataset.push({ source: [json] })
         series.push({
           name: json['NCCAT'],
           stack: site,
   ```
   效果如下Result as bellow:
   
![image](https://github.com/user-attachments/assets/abf188b5-fc66-4377-9028-65ef9b5af946)
   


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