ridermansb
ridermansb

Reputation: 11059

How to align two texts on right in d3

How to align text to the left of another text that is right-aligned?

Must be two distinct elements texts (one for numbers and one for 'R$') because each will have a different style (like image below)

enter image description here

To facilitate the example, made ​​a small code in JSBin

http://jsbin.com/qukoto/4/edit

Upvotes: 2

Views: 712

Answers (1)

Robert Longson
Robert Longson

Reputation: 124039

So that it is next to each value you mean? I.e. like this

text = summary.append "text"
  .attr "text-anchor": "end", x: 250
text.append "tspan"
   .text "R$ "
   .attr  "class": "summary-currency"
text.append "tspan"
  .text (d) -> d3.format(',.0f') d
  .attr "class": "summary-value"

Upvotes: 2

Related Questions