d3-mitch-tree icon indicating copy to clipboard operation
d3-mitch-tree copied to clipboard

Can I make the Textbox collapsible to fill it with more description?

Open altmandian opened this issue 3 years ago • 1 comments

I want the Nodeboxes to fill more words for the description, including a link to folow maybe. How can I make the boxes fit the content?

I know, that the function to fill the Textbox is:

// D3Plus Textbox with resizing capability
        var d3PlusBodyTextBox = new d3PlusTextBox()
            .select(element) // Sets the D3Plus code to append to the specified DOM element.
            .data(singledOutData)
            .text((data, index, arr) => {
                return self.getBodyDisplayText.call(self, data);
            })
            .textAnchor("middle")
            .verticalAlign("middle")
            .fontSize(13) // in pixels
            .x(nodeBodyBoxPadding.left)
            .y(recalculatedPaddingTop - nodeBodyBoxHeight / 2)
            .width(nodeBodyBoxWidth - nodeBodyBoxPadding.left - nodeBodyBoxPadding.right)
            .height(nodeBodyBoxHeight - recalculatedPaddingTop - nodeBodyBoxPadding.bottom)
            .ellipsis((text, line) => {
                // If text was cut-off, add tooltip
                selection.append("title")
                    .text(self.getBodyDisplayText(data));
                return ((text.replace(/\.|,$/g, "")) + "...");
            })
            .render();
    });

I am not sure, how to change it, so it will would fit my content inside the, or the box is spread out by the lenght of my conten. It would be great to know how to do that.

Thank you :)

te

altmandian avatar Feb 22 '22 10:02 altmandian

maybe you can enlarge the box like this

const treePlugin = new mitchTree.boxedTree()
.setData(fetchedData)
.setElement(target_element)
.getNodeSettings()
.setSizingMode('nodeSize')
.setBodyBoxWidth(300)
.back()
.initialize()

RyanB1303 avatar Mar 02 '23 23:03 RyanB1303