We need to dynamically set the width of node as per text size(annotation).
We tried by setting the maxWidth and minWidth (please refer below code snippet) but it didn't help.
obj.shape = { type: 'Basic', shape: 'Rectangle' };
obj.style = {
fill: '#0f8fe4',
strokeWidth: 0
};
// node text css object
obj.minWidth = 100;
obj.maxWidth = 250;
obj.height = 2;
obj.annotations = [
{
content: nodeData.name,
offset: { x: 0.5, y: 0 },
verticalAlignment: 'Bottom',
style: {
textOverflow: 'Ellipsis',
textWrapping: 'NoWrap'
},
minWidth: 110,
maxWidth: 235
}
];
Also please refer attached screenshot where the size of 1st node is fine but in 2nd node as length of text is less in that case we want to decrease size of that node as per inner text.
It would be great help if there is any other solution for this requirement.