This commit is contained in:
qumeng039@126.com 2025-08-11 15:38:05 +08:00
commit 057abc4c51
2 changed files with 31 additions and 27 deletions

View File

@ -174,16 +174,6 @@ const initChart = async() => {
// //
chartInstance.on('mouseover', function(params) { chartInstance.on('mouseover', function(params) {
if (!params.data) return; if (!params.data) return;
/* const isBridgeNode = params.data.category === 0;
if (isBridgeNode) {
//
const nodeId = params.data.originalId;
//
activeNodeId.value = nodeId;
updateNodeImage(nodeId, true);
} */
if (params.dataType === 'node') { if (params.dataType === 'node') {
// //
chartInstance.dispatchAction({ chartInstance.dispatchAction({
@ -192,7 +182,7 @@ const initChart = async() => {
dataIndex: params.dataIndex dataIndex: params.dataIndex
}); });
// //
const isBridgeNode = params.data.category === 0; const isBridgeNode = params.data.category === 0;
if (isBridgeNode) { if (isBridgeNode) {
const nodeId = params.data.originalId; const nodeId = params.data.originalId;
@ -203,7 +193,6 @@ const initChart = async() => {
// //
chartInstance.dispatchAction({ type: 'unfocusNodeAdjacency', seriesIndex: SERIES_INDEX }); chartInstance.dispatchAction({ type: 'unfocusNodeAdjacency', seriesIndex: SERIES_INDEX });
chartInstance.dispatchAction({ type: 'downplay', seriesIndex: SERIES_INDEX }); chartInstance.dispatchAction({ type: 'downplay', seriesIndex: SERIES_INDEX });
// tooltip formatter
} }
}); });
@ -211,15 +200,6 @@ const initChart = async() => {
// //
chartInstance.on('mouseout', function(params) { chartInstance.on('mouseout', function(params) {
if (!params.data) return; if (!params.data) return;
/* const isBridgeNode = params.data.category === 0;
if (isBridgeNode) {
//
const nodeId = params.data.originalId;
if (activeNodeId.value === nodeId) {
activeNodeId.value = null;
updateNodeImage(nodeId, false);
}
} */
if (params.dataType === 'node') { if (params.dataType === 'node') {
// //
chartInstance.dispatchAction({ chartInstance.dispatchAction({

View File

@ -51,6 +51,24 @@ const initChart = async () => {
// //
chart = echarts.init(document.getElementById("container")) chart = echarts.init(document.getElementById("container"))
const SERIES_INDEX = 0;
//
chart.on('mouseover', function(params) {
if (!params.data) return;
if (params.dataType === 'node') {
//
chart.dispatchAction({
type: 'focusNodeAdjacency',
seriesIndex: SERIES_INDEX,
dataIndex: params.dataIndex
});
} else if (params.dataType === 'edge') {
//
chart.dispatchAction({ type: 'unfocusNodeAdjacency', seriesIndex: SERIES_INDEX });
chart.dispatchAction({ type: 'downplay', seriesIndex: SERIES_INDEX });
}
});
//data //data
//key: id value: //key: id value:
//id //id
@ -267,12 +285,18 @@ const initChart = async () => {
width: 1 width: 1
}, },
emphasis: { emphasis: {
// focus: 'adjacency', // blur
focus: "adjacency", // blurScope: 'series', //
lineStyle: { scale: false, //
// 线 lineStyle: { opacity: 1 },
width: 5 // 线(10) itemStyle: { opacity: 1 },
} label: { opacity: 1 }
},
blur: {
// /
lineStyle: { opacity: 0.05 },
itemStyle: { opacity: 0.1 },
label: { opacity: 0 }
} }
} }
] ]