echarts鼠标移入效果自定义显示 2018-06-09
2018-06-09 本文已影响26人
菜鸟搬砖
项目中遇到使用echarts在鼠标移入时不显示当前移入的信息而是自定义的
echarts中有一个formatter方法,在tooltip上直接写入
formatter:function (){
//这里是可以传递参数的
var str='这是需要显示的东西';
return str
}
这样在鼠标移入的时候就可以显示自定义的提示,另附代码图:
![](https://img.haomeiwen.com/i6868161/9242c8031d1eb50d.png)
移入后效果:
![](https://img.haomeiwen.com/i6868161/fb818e944534ea99.png)