console.log(d3.selectAll(".bubble-label-name").filter((d) -> textValue(d) == wor).style("background-color", "red"))
在这里,我能够根据需要(d)-> textValue(d)匹配wor的适配函数设置背景色-这是一个包含字符串的变量。
我想使用变量wor作为数组,以便当(d)-> textValue(d)匹配数组wor中的字符串时过滤器为true。
正如Mark所指出的,这是过滤器的正确代码。
wor = something # an array
console.log(d3.selectAll(".bubble-label-name").filter((d) -> textValue(d) in wor).style("background-color", "red"))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句