第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

確定段落的高度

確定段落的高度

繁星淼淼 2023-07-06 17:18:26
我創(chuàng)建了表格行標(biāo)題,如下所示。我想在這 4 個(gè)標(biāo)題中創(chuàng)建一個(gè)矩形 svg 框。我無(wú)法確定段落高度,因此無(wú)法創(chuàng)建完全適合段落的框。這是我的代碼let svg = d3.select("body").append("svg").attr("width", 1000).attr("height", 1000);let text=["Who will win the election. Trump or Biden?","Data Analysis","Javascript","Compare Performance of S&P 500 Index against other Indices"  ]svg.selectAll("boxestext")    .data([0,100,200,300])    .enter()    .append("foreignObject")    .attr("width", (d, i) => 100 )    .attr("height", 200)    .attr("x",(d, i) => d)    .attr("y",0)    .attr("class", "boxes")    .append("xhtml:body")    .style("font", 50)    .html((d,i)=>"<p>"+text[i]+"</p>") https://codepen.io/zubair57/pen/MWeXPqX
查看完整描述

1 回答

?
守著星空守著你

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超8個(gè)贊

let svg = d3.select("body").append("svg").attr("width", 1000).attr("height", 1000);


let text=[

"Who will win the election. Trump or Biden?",

"Data Analysis",

"Javascript",

"Compare Performance of S&P 500 Index against other Indices"  

]

let texty=svg.selectAll("boxestext")

    .data([0,100,200,300])

    .enter()

    .append("foreignObject")

  

    .attr("width", (d, i) => 100 )

    .attr("height", 200)

    .attr("x",(d, i) => d)

    .attr("y",0)

    .attr("class", "boxes")

    .append("xhtml:body")

    .attr("class","mytext")

.attr("id",(d,i)=>"mytext"+i)

    .style("font", 50)

    .html((d,i)=>"<p>"+text[i]+"</p>") 


let rect = d3.selectAll("p").node().getBoundingClientRect()

console.log(rect.height)///

p {text-align: left;}

.boxes p{

  border:1px solid;

}

 <script src="https://d3js.org/d3.v5.min.js"></script>


查看完整回答
反對(duì) 回復(fù) 2023-07-06
  • 1 回答
  • 0 關(guān)注
  • 150 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)