I added the node label with its name and value to a network D3 Sankey in R using a javascript as follows:
javascript_string <-
'function(el, x){
d3.select(el).selectAll(".node text")
.text(d => d.name + " (" + d.value + ")");
}'
The resulting Sankey shows some of these values upto 10 decimal places which is too precise. I only want for it to show the values upto 2 decimal places. What do I change in this javascript string to limit the d.value to 2 decimal places?
Thank you!
I tried adding node label with name and value to a network D3 sankey in R using a javascript string. It did add the labels as I wanted but some of the values in the resulting image were too precise. I want to limit it to 2 decimal places only.