Skip to content

Instantly share code, notes, and snippets.

@JakenHerman
Created December 8, 2020 05:05
Show Gist options
  • Save JakenHerman/90022cfcd1198ab0d7120f20189df06f to your computer and use it in GitHub Desktop.
Save JakenHerman/90022cfcd1198ab0d7120f20189df06f to your computer and use it in GitHub Desktop.
text = svg.selectAll('.percentRank')
.data(percentileData)
.enter()
.append('text')
.attr('class', 'percentRank')
.attr('x', d => getTextXValue(d.cx))
.attr('y', d => d.cy + 3)
.text(d => Math.floor((d.cx/150)*100))
.attr('font-weight', 'bolder')
.attr('font-size', '.7rem')
.attr('fill', d => (Math.floor((d.cx/150)*100) >= 70 ||
Math.floor((d.cx/150)*100) <= 30)
? 'white' : 'black');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment