fix legend

This commit is contained in:
Qiuxia Fan 2022-03-29 10:36:17 +08:00
parent 355fe215a3
commit 924cf01d95
2 changed files with 3 additions and 4 deletions

View File

@ -42,7 +42,7 @@ export default function topoLegend(
.map((d: any) => `${d.name} ${d.condition} ${d.value}`) .map((d: any) => `${d.name} ${d.condition} ${d.value}`)
.join(" and "); .join(" and ");
return item === "CUBEERROR" return item === "CUBEERROR"
? config ? config && config.length
? `Unhealthy (${str})` ? `Unhealthy (${str})`
: "Unhealthy" : "Unhealthy"
: "Healthy"; : "Healthy";

View File

@ -55,11 +55,10 @@ export default (d3: any, graph: any, funcs: any, tip: any, legend: any) => {
} }
let c = true; let c = true;
for (const l of legend) { for (const l of legend) {
const val = l.name.includes("_sla") ? d[l.name] / 100 : d[l.name];
if (l.condition === "<") { if (l.condition === "<") {
c = c && val < Number(l.value); c = c && d[l.name] < Number(l.value);
} else { } else {
c = c && val > Number(l.value); c = c && d[l.name] > Number(l.value);
} }
} }
return c && d.isReal ? icons.CUBEERROR : icons.CUBE; return c && d.isReal ? icons.CUBEERROR : icons.CUBE;