<div style="display:none;">
<p class="pf-count" data-count="nevada">2</p>
<p class="pf-count" data-count="ohio">4</p>
<p class="pf-count" data-count="miami">1</p>
</div>
<svg>
<text class="pf-state" data-state="miami"></text>
<text class="pf-state" data-state="nevada"></text>
<text class="pf-state" data-state="ohio"></text>
</svg>
<script>
e = document.getElementsByClassName("pf-count")
c = document.getElementsByClassName("pf-state")
for (let i = 0; i <= e.length-1; i++){
o = e[i]
for (let s = 0; s <= c.length-1; s++){
if (c[s].dataset.state == o.dataset.count){
c[s].setHTML(o.textContent)
break
}
}
}
</script>
что-то такое?