tz158310601 commented on issue #9344: pie图使用dataset,然后label使用{c},显示上有问题
URL: 
https://github.com/apache/incubator-echarts/issues/9344#issuecomment-465848477
 
 
   我改写了这个方法,将就凑合一下吧
   function formatTpl(tpl, paramsList, encode) {
       if (!isArray(paramsList)) {
           paramsList = [paramsList];
       }
       var seriesLen = paramsList.length;
       if (!seriesLen) {
           return '';
       }
   
       var $vars = paramsList[0].$vars || [];
       for (var i = 0; i < $vars.length; i++) {
           var alias = TPL_VAR_ALIAS[i];
           tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0));
       }
       for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) {
           for (var k = 0; k < $vars.length; k++) {
               var val = paramsList[seriesIdx][$vars[k]];
                        if (zrUtil.isObject(val)) {
                                
if(paramsList[seriesIdx].componentSubType=='pie'){
                                        for( var key in val){
                                                if(val[key] 
!=paramsList[seriesIdx].name){
                                                        val =val[key] 
                                                }
                                        }
                                }
                        }
               tpl = tpl.replace(
                   wrapVar(TPL_VAR_ALIAS[k], seriesIdx),
                   encode ? encodeHTML(val) : val
               );
           }
       }
   
       return tpl;
   }
   
   
   
   -----------------只有当dataset只有两维数据才有效。如果数据维度多了,这个循环可能就指向的是错误 的数据了

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to