zhouxin860114 commented on issue #11347: 
toolTip的formatter属性里,用function自定义时,打印出params.seriesName不能跟配置的系列名对应
URL: 
https://github.com/apache/incubator-echarts/issues/11347#issuecomment-540426587
 
 
   说得有点乱,总结一下,我估计是这么回事:
   1、你的两个 map series 是重叠的,最上层的 series 是「分组1」
   2、「分组1」显示时,鼠标事件被「分组1」的图形捕获,params 里的 series 是「分组1」,所以自定义的 formatter 
只能显示「分组1」的属性
   3、 默认的 formatter 似乎会遍历所有 series,把有数据的 series 都显示出来,并把数值相加,如下图:
   
![image](https://user-images.githubusercontent.com/8022228/66546429-92e6b080-eb6f-11e9-92cd-944811701d08.png)
   
![image](https://user-images.githubusercontent.com/8022228/66546769-46e83b80-eb70-11e9-8a47-c98df094017b.png)
   
   ```
   formatTooltip: function(dataIndex) {
       // FIXME orignalData and data is a bit confusing
       var data = this.getData();
       var formattedValue = addCommas(this.getRawValue(dataIndex));
       var name = data.getName(dataIndex);
   
       var seriesGroup = this.seriesGroup;
       var seriesNames = [];
       for (var i = 0; i < seriesGroup.length; i++) {
           var otherIndex = seriesGroup[i].originalData.indexOfName(name);
           var valueDim = data.mapDimension('value');
           if (!isNaN(seriesGroup[i].originalData.get(valueDim, otherIndex))) {
               seriesNames.push(
                   encodeHTML(seriesGroup[i].name)
               );
           }
       }
   
       return seriesNames.join(', ') + '<br />' +
           encodeHTML(name + ' : ' + formattedValue);
   },
   ```
   ——————————————————
   图例可以自定义,第一个回答里,我后来贴上的那段代码,就是包含自定义图例的

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