1
This commit is contained in:
parent
f55627e0c0
commit
690a7fc670
|
|
@ -204,75 +204,7 @@ const clusterAnalyze = () => {
|
||||||
console.log(storeId)
|
console.log(storeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAnomalousGroup() {
|
function handleAnomalousGroup() {}
|
||||||
console.log(storeId)
|
|
||||||
|
|
||||||
// 当前时间从 store 取;没有就用 T0
|
|
||||||
const now = (props.store.currentUtc);
|
|
||||||
|
|
||||||
const TA = "2024-06-19T08:57:55Z"; // A
|
|
||||||
const TB = "2024-06-19T10:58:03Z"; // B
|
|
||||||
const TC = "2024-06-19T12:58:04Z"; // C
|
|
||||||
|
|
||||||
// 组色(与你现有 colorMap 一致)
|
|
||||||
const GROUP_COLOR = { 0: "12,112,144", 1: "180,150,20", 6: "50,141,120" };
|
|
||||||
const GROUP_ALPHA = 0.30;
|
|
||||||
|
|
||||||
const RED = "220,50,60";
|
|
||||||
|
|
||||||
// 覆盖画三大组大圆(蓝/黄/绿透明)
|
|
||||||
/* const buckets = new Map();
|
|
||||||
graphVis.nodes.forEach(n => {
|
|
||||||
const t = parseInt(n.type); // "0"|"1"|"6" → 0/1/6
|
|
||||||
if (!buckets.has(t)) buckets.set(t, []);
|
|
||||||
buckets.get(t).push(n);
|
|
||||||
});
|
|
||||||
buckets.forEach((nodes, t) => {
|
|
||||||
const color = GROUP_COLOR[t] || "120,120,120";
|
|
||||||
const g = graphVis.addNodesInGroup(nodes, { shape: "circle", color, alpha: GROUP_ALPHA });
|
|
||||||
g.smoothPath = false;
|
|
||||||
}); */
|
|
||||||
|
|
||||||
// 时间门控:达到阈值就把各组异常节点染红 + 加红圈
|
|
||||||
const shouldA = now >= TA;
|
|
||||||
const shouldB = now >= TB;
|
|
||||||
const shouldC = now >= TC;
|
|
||||||
|
|
||||||
if(shouldA) {
|
|
||||||
console.log("A异常")
|
|
||||||
|
|
||||||
graphVis.nodes = graphVis.nodes.map(n => {
|
|
||||||
if(props.store.graphAbnormalData.groupA.includes(n.id)) {
|
|
||||||
n.fillColor = RED;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(shouldB) {
|
|
||||||
console.log("B异常")
|
|
||||||
graphVis.nodes = graphVis.nodes.map(n => {
|
|
||||||
if(props.store.graphAbnormalData.groupB.includes(n.id)) {
|
|
||||||
n.fillColor = RED;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(shouldC) {
|
|
||||||
console.log("C异常")
|
|
||||||
|
|
||||||
graphVis.nodes = graphVis.nodes.map(n => {
|
|
||||||
if(props.store.graphAbnormalData.groupC.includes(n.id)) {
|
|
||||||
n.fillColor = RED;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
graphVis.autoGroupLayout(graphVis.nodes);
|
|
||||||
graphVis.zoomFit(); // 没有 refresh;这两个就够
|
|
||||||
}
|
|
||||||
|
|
||||||
new Map([
|
new Map([
|
||||||
["groupDiscovery", () => handleGroupDiscoveryDiff()],
|
["groupDiscovery", () => handleGroupDiscoveryDiff()],
|
||||||
|
|
@ -284,16 +216,16 @@ const clusterAnalyze = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仅对“异常群体模块”生效:时间变化时强制重绘一次
|
// 仅对“异常群体模块”生效:时间变化时强制重绘一次
|
||||||
if (storeId === 'anomalousGroup') {
|
if (storeId === "anomalousGroup") {
|
||||||
watch(
|
watch(
|
||||||
() => props.store.currentUtc,
|
() => props.store.currentUtc,
|
||||||
() => {
|
() => {
|
||||||
// 不改 graph 数据结构,直接用当前 graph 强制走一遍:addGraph → clusterAnalyze → runForceLayout
|
// 不改 graph 数据结构,直接用当前 graph 强制走一遍:addGraph → clusterAnalyze → runForceLayout
|
||||||
if (graphVis) {
|
if (graphVis) {
|
||||||
updateChart(toRaw(graph.value));
|
updateChart(toRaw(graph.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实例化 GraphVis、注册自定义绘制/事件
|
// 实例化 GraphVis、注册自定义绘制/事件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user