0

In my fiddle here, the % symbol is currently in fixed position. How do I align it so that it floats accordingly if the number changes from one digit to two digit to three digit?

I tried:

   .style("float", "left")

But it didnt work. What am I missing?

Rahul Desai
  • 15,242
  • 19
  • 83
  • 138

2 Answers2

3

Not good, but worked Fiddle:

g.append("text")
 .attr(
     "x", 
     parseInt(textElement.attr("x")) + parseInt(textElement[0][0].clientWidth)
 ) 

Unknown User's solution correctly.

Unknown User
  • 3,598
  • 9
  • 43
  • 81
maximkou
  • 5,252
  • 1
  • 20
  • 41
2

You can simply concatenate with the % symbol and so it dances accordingly.

Demo

animuson
  • 53,861
  • 28
  • 137
  • 147
Unknown User
  • 3,598
  • 9
  • 43
  • 81