Dear all, I’m using the simple d3.max function, but why d3.max cannot find the real maximum value?
This is because it’s comparing strings, not numbers.
Try this instead:
maxP = d3.max(data, d => Number(d.P))
Can I ask why you picked Number(d.P)
over +d.P
? According to the chart in this article they behave identically.
2 Likes
Oh, I didn’t give it too much thought. I may have been writing too much code in other languages recently…
1 Like