我正在使用d3在浏览器上绘制物品。我想根据它们的属性突出显示其中的一些项目。例如,我有杂货和肥皂,在其中肥皂元素将具有类型
如何实现?
此外,我的另一个疑问是document.getElementById()在d3所选代码内不起作用。我的判断正确还是疏忽了什么? 编辑
[for_bath (OR) for_cloth_wash]
。我想选择所有肥皂和杂货中特定于for_bath
的元素,并在同一屏幕上绘制它们。如何实现?
此外,我的另一个疑问是document.getElementById()在d3所选代码内不起作用。我的判断正确还是疏忽了什么? 编辑
var data = {"soaps":{"lux":"bath", "cinthol":"bath", "rin","cloth_washing"},
"shoes":{"valentine":"teens", "bootie":"kids", "kuuch":"kids"}};
// Now I want to show all bath soaps highlighted, may be with a circle around them.
var svg = d3.select("svg")
.selectAll(".items")
.data(data).enter()
.append("circle")
// highlighting styles
;
我想选择洗浴皂并将它们整理起来。