1

I'm using d3 tip box and I want to print a string. However I cannot change lines between my 'index' and 'other information'. Tried already \r, \n, \r\n, but none of them works.

Thanks!

My code is:

  // Show additional infomation in the tip
  var tip = d3.tip()
      .attr('class', 'd3-tip')
      .offset([-10, 0])
      .html(function(d) { return "index: " + d.index + "other information..."; });
jiayi
  • 89
  • 10

1 Answers1

1

You can use normal HTML tags, like br:

 var tip = d3.tip()
  .attr('class', 'd3-tip')
  .offset([-10, 0])
  .html(function(d) { return "index:<br> " + d.index + "other information..."; });
Gerardo Furtado
  • 100,839
  • 9
  • 121
  • 171