码迷,mamicode.com
首页 > 其他好文 > 详细

echartsx轴名称过长,截断+鼠标划过显示全称

时间:2018-10-08 18:11:06      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:tty   none   char   params   htm   get   css   function   art   

xAxis : [
{
triggerEvent:true,//这句很重要,没有不会触发事件

……

}
],

……

videoChart.setOption(option);


extension(videoChart);
function extension(mychart) {
           
//判断是否创建过div框,如果创建过就不再创建了                       
var id = document.getElementById("extension");
if(!id) {
var div = "<div id = ‘extension‘ style=\"display:none\"></div>" ;
$(‘html‘).append(div);
}
}
videoChart.on(‘mouseover‘, function (params) {
console.log(params);
if(params.componentType == "xAxis") {
$(‘#extension‘).css({
"position": "absolute",
"color": "black",
"font-family": "Arial",
"font-size": "14px",
"padding": "5px",
"top":"50px",
"display":"inline-block",
"z-index":"2000"
}).text(params.value);                               
$("html").mousemove(function(event) {                           
var xx = event.pageX - 30;
var yy = event.pageY + 20;
$(‘#extension‘).css(‘top‘, yy).css(‘left‘, xx);
}); 
                         

});
videoChart.on(‘mouseout‘, function(params) { 
if(params.componentType == "xAxis") {
$(‘#extension‘).css(‘display‘, ‘none‘);
}                       
});

echartsx轴名称过长,截断+鼠标划过显示全称

标签:tty   none   char   params   htm   get   css   function   art   

原文地址:https://www.cnblogs.com/monozxy/p/9755697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!