This message was deleted.
# help
s
This message was deleted.
c
I think the problem is that I’m trying to call elements from the original array, but the path has been grouped and transformed.
const path = svg
.append(“g”)
.attr(“fill”, “none”)
// .attr(“stroke”, color)
.attr(“stroke-linecap”, strokeLinecap)
.attr(“stroke-linejoin”, strokeLinejoin)
.attr(“stroke-width”, strokeWidth)
.attr(“stroke-opacity”, strokeOpacity)
.selectAll(“path”)
.data(d3.group(I, (i) => Z[i]))
.join(“path”)
.attr(“stroke”, color)
.attr(“d”, ([, I]) => line(I));
l
Exactly! I hit send too soon, but that's basically what I was saying. So if you access the state name with
d[0]
instead of
d.state
in the color function, it works.
Because the data elements now look like this:
['California', Array(36)]
Like so, in case that's unclear:
Copy code
color: (d) => (d[0] == "California" ? "red" : "steelblue"),
(I was looking at attempt2)
c
Libbey, you’re a rock star!
👏 1
Thank you!!!
l
Yay, you're welcome!