AntV G2Plot的饼图中,鼠标划入label提示内容
由于官网未提供相应API,所以自己写监听事件
var tooltip = document.getElementById("tipContent");
var tipSpanCircular = document.getElementsByClassName("tipSpanCircular")[0];
piePlot.on("label:mouseenter", (...args) => {
tipContent.value = args[0].data.data.type;
tipSpanValue.value = args[0].data.data.value;
tooltip.style.display = "inline-block";
tipSpanCircular.style.backgroundColor = args[0].data.color;
tooltip.style.left =args[0].event.layerX + "px";
tooltip.style.top =args[0].event.layerY+40 + "px";
});
piePlot.on("label:mouseleave", (...args) => {
tooltip.style.display = "none";
});