2

I trying to use d3plus-text. First i append new text element on svg element

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

and then i want to wrap that text

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

But i am getting error on 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) {

I am certain there are nodeText elements. What am I doing wrong? Thanks

  • Your question is "how do I convert an existing text element to a d3plus-text textbox"? I don't see that supported in it's documentation. Why aren't you using it as documented? – Mark Dec 31 '20 at 16:28
  • I have that text element and I want to wrap it and autoscale it, so im trying to find a library that can do that for me. – Uros Velickovic Jan 02 '21 at 10:25

0 Answers0