echarts showTip 无法触发解决 (调整grid)"/>
echarts showTip 无法触发解决 (调整grid)
"echarts": "5.4.0",
"vue": "2.6.12",
在interval的时候 showtip 发现如果数据为0,那么 dispatchAction showTip 不会触发,
myChart.dispatchAction({
type: "showTip",
seriesIndex: 0,
dataIndex: currentIndex,
// name: option.xAxis[0].data[currentIndex],
});
经过多次测试发现 是showTip 与grid设置冲突
当grid设置中有百分比时 showTip 数据为0时不会触发,后改为具体数值 showTip为0也会触发
grid: {
top: 30,
left: 20,
right: 20,
bottom: 10,
containLabel: true,
},
tooltip: {
show: true,
backgroundColor: "RGBA(3, 12, 53, 0.9)",
trigger: "axis",
formatter: function (param) {
let total = 0;
let xName = "";
let qoq = "";
let yoy = "";
param.map((item) => {
total = item.data.docSum;
xName = item.axisValue;
item.data.qoq ? (qoq = item.data.qoq) : "";
item.data.yoy ? (yoy = item.data.yoy) : "";
});
let isUpDownQOQ = qoq.indexOf("-");
let isUpDownYOY = yoy.indexOf("-");
let str = "";
if (isUpDownQOQ === -1) {
str = `<img src="${_this.upImg}" width="10px">`;
} else {
str = `<img src="${_this.downImg}" width="10px">`;
}
let str2 = "";
if (isUpDownYOY === -1) {
str2 = `<img src="${_this.upImg}" width="10px">`;
} else {
str2 = `<img src="${_this.downImg}" width="10px">`;
}
console.log(param);
return `${xName}文件统计<br/>文件总量:${total}<br/>环比:${qoq}%${str}<br/>同比:${yoy}%${str2}`;
},
textStyle: { color: "#fff" },
borderWidth: 0,
},
更多推荐
echarts showTip 无法触发解决 (调整grid)
发布评论