Yawenina commented on issue #8135: 地图中如何获取各个省份的渲染颜色
URL: 
https://github.com/apache/incubator-echarts/issues/8135#issuecomment-380694539
 
 
   解决了,在 `series[i].label.formatter` 中通过 `params.color` 获取渲染颜色。
   之前搞错了在外层的`label`中和获取了。。。
   
   ```javascript
   series: [{
       label: {
               formatter: (params) => {
                 const topFive = this.chartData.slice(0, 5).map(item => 
item.name);
                 if (topFive.includes(params.name)) {
                   const { name, value, color } = params;
                   this.topFiveLegend.push({
                     name,
                     value,
                     color
                   })
                 }
                 return `${params.name}: ${params.value}%`;
               }
             }
   }]
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org
For additional commands, e-mail: dev-h...@echarts.apache.org

Reply via email to