简体   繁体   English

将文本粗体显示在出现在mouseover-D3上的文本框中

[英]Bold the text partially in a text box which popos up on mouseover-D3

I have the following D3 code. 我有以下D3代码。

    var tooltip= d3.select("body").append("div")
                .style("position", "absolute").style("display", "none")

    circ.on("mouseover", function(d){   //circ is a circle
            tooltip.html(d.venue  +"<br/>"  + d.var2 + ", " + d.var3)
                .style('left', (d3.event.pageX - 30 ) + 'px')  // Showing the d.count 
                .style('top',  (d3.event.pageY - 30 + 'px')
                .style("font-size","10px")
                .style("padding", "5px")
                .style("display", "block") 
                .style("background", "White")
                .style("color","black")  //font color

I want to bold the venue(d.venue) only and need to get in one line and the remaining two variables in the next line of the comment box without bold. 我只想粗体显示会场(d.venue),需要在注释框的下一行中插入一行,其余两个变量不加粗。

这应该工作

tooltip.html("<b>" + d.venue  +"</b><br/>"  + d.var2 + ", " + d.var3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM