Skip to content

Instantly share code, notes, and snippets.

@russelllim22
Last active December 28, 2021 04:59
Show Gist options
  • Save russelllim22/30059a2db8526e0b0dfdd40083a68a00 to your computer and use it in GitHub Desktop.
Save russelllim22/30059a2db8526e0b0dfdd40083a68a00 to your computer and use it in GitHub Desktop.
{#each letterCounts as d, i}
<!-- code for bars and labels here -->
<g width = {xScale(d.count)} height = {yScale.bandwidth()}
style="transform: translate({xScale(d.count)/2}px,{yScale(d.letter) + yScale.bandwidth()/2}px); text-anchor: middle">
{#if d.words.length > 0}
{#each d.words as word}
<text x={word.x} y={word.y} style="transform: translate({word.x}, {word.y});
font-size: {word.size}px;
fill: {cat10colors[Math.floor(Math.random()*10)]}">
{word.text}
</text>
{/each}
{/if}
</g>
{/each}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment