how do I convert an existing text element to a d3plus-text textbox?

154 Views Asked by At

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

0

There are 0 best solutions below