需要动态更改优先级类别文字的颜色
let color: any = d3
.scaleOrdinal()
.range(<any[]>[
"#15bd40",
"#ff245d",
"#c5a5fa",
"#e2e2e3",
"#f3c20b",
"#2286eb"
]);
.on("mouseover", function(d: any) {
let g = d3
.select(element)
.style("cursor", "pointer")
.append("g")
.attr("class", "priority-group");
g.append("text")
.attr("class", "priority-text")
.text(`${d.data.label}`);
g.append("text")
.attr("class", "priority-count")
.text(`${d.data.count}`)
.attr("fill", function(d: any) {
return color(d.data.label);
});
})
我尝试使用填充功能,但计数文本被隐藏