onesight-charts 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -919,6 +919,38 @@ function VerticalStackedBar(props) {
|
|
|
919
919
|
dataIndex: event.dataIndex
|
|
920
920
|
});
|
|
921
921
|
currentIndex = event.dataIndex;
|
|
922
|
+
|
|
923
|
+
// 首次 showTip 后 ECharts 才会创建 tooltip DOM
|
|
924
|
+
// 给 tooltip DOM 绑定一次鼠标进出事件:
|
|
925
|
+
// - 鼠标进入自定义 tooltip 时,隐藏 axisPointer 阴影
|
|
926
|
+
// - 鼠标离开时,ECharts 会自行隐藏 tooltip,同时把阴影也置为透明
|
|
927
|
+
setTimeout(function () {
|
|
928
|
+
var chartDom = myChart.getDom();
|
|
929
|
+
var parentElement = (chartDom === null || chartDom === void 0 ? void 0 : chartDom.parentElement) || chartDom;
|
|
930
|
+
var tooltipEl = parentElement === null || parentElement === void 0 ? void 0 : parentElement.querySelector(".".concat(tooltipClassNameRef.current));
|
|
931
|
+
if (tooltipEl && !tooltipEl.dataset.axisPointerBound) {
|
|
932
|
+
tooltipEl.addEventListener('mouseenter', function () {
|
|
933
|
+
toggleAxisPointer(myChart, false);
|
|
934
|
+
});
|
|
935
|
+
tooltipEl.addEventListener('mouseleave', function () {
|
|
936
|
+
toggleAxisPointer(myChart, false);
|
|
937
|
+
myChart.dispatchAction({
|
|
938
|
+
type: 'hideTip'
|
|
939
|
+
});
|
|
940
|
+
myChart.dispatchAction({
|
|
941
|
+
type: 'downplay',
|
|
942
|
+
dataIndex: currentIndex
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
tooltipEl.dataset.axisPointerBound = 'true';
|
|
946
|
+
}
|
|
947
|
+
}, 0);
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
// tooltip 隐藏时,重置 axisPointer 阴影为透明,避免残留
|
|
951
|
+
myChart.off('hideTip');
|
|
952
|
+
myChart.on('hideTip', function () {
|
|
953
|
+
toggleAxisPointer(myChart, false);
|
|
922
954
|
});
|
|
923
955
|
myChart.setOption(option, true);
|
|
924
956
|
|
|
@@ -865,6 +865,31 @@ function VerticalStackedBar(props) {
|
|
|
865
865
|
dataIndex: event.dataIndex
|
|
866
866
|
});
|
|
867
867
|
currentIndex = event.dataIndex;
|
|
868
|
+
setTimeout(() => {
|
|
869
|
+
const chartDom = myChart.getDom();
|
|
870
|
+
const parentElement = (chartDom == null ? void 0 : chartDom.parentElement) || chartDom;
|
|
871
|
+
const tooltipEl = parentElement == null ? void 0 : parentElement.querySelector(
|
|
872
|
+
`.${tooltipClassNameRef.current}`
|
|
873
|
+
);
|
|
874
|
+
if (tooltipEl && !tooltipEl.dataset.axisPointerBound) {
|
|
875
|
+
tooltipEl.addEventListener("mouseenter", () => {
|
|
876
|
+
toggleAxisPointer(myChart, false);
|
|
877
|
+
});
|
|
878
|
+
tooltipEl.addEventListener("mouseleave", () => {
|
|
879
|
+
toggleAxisPointer(myChart, false);
|
|
880
|
+
myChart.dispatchAction({ type: "hideTip" });
|
|
881
|
+
myChart.dispatchAction({
|
|
882
|
+
type: "downplay",
|
|
883
|
+
dataIndex: currentIndex
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
tooltipEl.dataset.axisPointerBound = "true";
|
|
887
|
+
}
|
|
888
|
+
}, 0);
|
|
889
|
+
});
|
|
890
|
+
myChart.off("hideTip");
|
|
891
|
+
myChart.on("hideTip", function() {
|
|
892
|
+
toggleAxisPointer(myChart, false);
|
|
868
893
|
});
|
|
869
894
|
myChart.setOption(option, true);
|
|
870
895
|
if (showTotal) {
|