如何将现有文本元素转换为 d3plus-text 文本框?

问题描述

我尝试使用 d3plus-text。首先我在 svg 元素上附加新的文本元素

node.append("text")
.text(function (d: any) { return d.properties.name; })
.attr("class","nodeText");

然后我想换行

new d3PlusText.TextBox()
.select(".nodeText")
.fontResize(true)
.width(options.nodeRadius)
.render();

但我在渲染时出错

    TypeError: Cannot read property 'reduce' of undefined
    TextBox.render
    node_modules/d3plus-text/es/src/TextBox.js:130
130 | var Boxes = this._select.selectAll(".d3plus-textBox").data(this._data.reduce(function (arr,d,i) {

我确定有 nodeText 元素。我究竟做错了什么? 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)