xinzai2014 opened a new issue #8143: 关系图,使用dispatchAction showTip显示提示框失效
URL: https://github.com/apache/incubator-echarts/issues/8143
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   
为了实现关系图的节点拖拽,使用了graphic组件,graphic层级高,因此节点原有的移入显示tooltip功能失效。需要手动在graphic上添加移入显示tooltip效果,至此发现dispatchAction
 showTip 事件不好用,mousemove可以触发,但是showTip 不能被触发
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:4.0.0
   + Browser version [浏览器类型和版本]:
   + OS Version [操作系统类型和版本]:
   
   ### Expected behaviour [期望结果]
   期望showTip能被触发,或者有其他的方法
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 
option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   option = {
        tooltip:{
   confine:true
      },
   animationDurationUpdate: 1500,
    animationEasingUpdate: 'quinticInOut',
   series:[
    {
                           type: 'graph',
                           layout: 'force',
                           force: {
                               //initLayout: 'circular',
                               gravity: 0.1,
                               // repulsion: 20,
                               edgeLength: 80,
                               repulsion: 100,
                               layoutAnimation:false
                           },
                           animation: false,
                           data: graph.nodes,
                           links: graph.links,
                           categories: categories,  
                           roam: true,   
                           draggable: false,
                           tooltip:{
                               formatter:function(param){
                                   var oPop=angular.element('.fixed-pop');
                                   if(oPop.length>0){
   
                                   }else{
                                       if(param.dataType=='node'){
                                           // console.log(param);
                                           var name=param.name;
                                           var dataList=param.data.dataList;
                                           var category=param.data.category;
                                           var id=param.data.id;
                                           return appendContent(param.data);
                                       }else{
                                           var nodes=graph.nodes;
                                           var sourceId=param.data.source;
                                           var targetId=param.data.target;
                                           return 
nodes[sourceId].name+'>'+nodes[targetId].name;
                                       }
                                   }
   
                               }
                           }
                       }
   ]
   }
   
   ```
   ```
   使用了graphic组件
   function initInvisibleGraphic();
   function initInvisibleGraphic() {
                   // Add shadow circles (which is not visible) to enable drag.
                   myChart.setOption({
                       graphic: echarts.util.map(option.series[0].data, 
function (item, dataIndex) {
                           var tmpPos=myChart.convertToPixel({'seriesIndex': 
0},[item.x,item.y]);
                           //var tmpPos=[item.x+500,item.y];
                           //console.log(dataIndex+":"+item.name+":"+tmpPos);
                           console.log(item);
                           return {
                               type: 'circle',
                               id:dataIndex,
                               position: tmpPos,
                               shape: {
                                   cx: 0,
                                   cy: 0,
                                   r: 20
                               },
                               // silent:true,
                               invisible: true,
                               draggable: true,
                               ondrag: echarts.util.curry(onPointDragging, 
dataIndex),
                               onmousemove: 
echarts.util.curry(showTooltip,item, dataIndex),
                               onclick:echarts.util.curry(fixTooltip),
                               onmouseout: echarts.util.curry(hideTooltip, 
dataIndex),
                               z: 100
                           };
                       })
                   });
                   window.addEventListener('resize', updatePosition);
                   myChart.on('dataZoom', updatePosition);
               }
   function showTooltip(item, dataIndex) {
                   console.log(dataIndex);
                   myChart.dispatchAction({
                       type: 'showTip',
                       dataIndex:dataIndex,
                       seriesIndex:0
                   });
               }
   
   ```
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   希望作者帮忙看一下,十分感谢
   @100pah
   @pissang
   

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