Link to ObserveableHQ: https://observablehq.com/@kickout/rectangles
(链接到ObservableHQ: https ://observablehq.com/@kickout/rectangles)
I've looked at these sources here , here
(我在这些来源看这里 , 这里)
Problem I am trying to solve: I draw 3 separate paths on a nested data object (each a different color).
(我要解决的问题:我在嵌套的数据对象(每个颜色不同)上绘制了3条单独的路径。)
Those paths are drawn based on (x,y) data.(这些路径是根据(x,y)数据绘制的。)
I want to have a the lines break when a different array (z) doesn't match (d.chr in my case)(我想在其他数组(z)不匹配时断行(我的情况是d.chr))
Line chart portion:
(折线图部分:)
ndat1.forEach(function(d) {
svg.append("path")
.attr('fill','none')
.attr("class",d.name)
.attr("stroke",colors(d.name))
.attr("d", line(d.effects))
.attr('opacity',0.1)
})
Line function (works fine without defined snippet):
(线路功能(无需定义摘要即可正常运行):)
line = d3.line()
//.defined(d => ndat1[d.chr]==1)
.x((d, i) => xScale(i))
.y(d => yScale(d))
Do i pass the entire d
to the line function (haven't got that to work) so that I can access both the y array ( d.effects
) and the defined array ( d.chr
)?
(我是否将整个d
传递给line函数(尚未起作用),以便可以访问y数组( d.effects
)和定义的数组( d.chr
)?)
I basically want to use a different array for d3.line().defined()
than i do for d3.line().y()
(我基本上想对d3.line().defined()
与我对d3.line().y()
不同的数组)
ask by K.J.J.K translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…