Label Height

Is it possible to "lock" the height of a label?  I know that you can set the width and height of a label (https://help.syncfusion.com/api/js/ejdiagram#members:nodes-labels-height)  but it doesn't seem to stick.  When the following code is called, I am able to edit the label of the "newComment" node but no matter what I set height or width to, the width seems = to the width of the node and the height seems to stretch as long as I type.  In the code example I have the width set that half the node's width and the full node's height, but it doesn't seem to matter.

createComment: function (offsetX, offsetY) {
            var diagram = $("#Diagram").ejDiagram("instance");
            let random = Math.floor(Math.random() * Math.floor(1000000));
            var newComment = {};
            newComment.name = "commentNode_" + random;
            newComment.offsetX = offsetX;
            newComment.offsetY = offsetY;
            newComment.height = 70;
            newComment.width = 160;
            newComment.type = ej.datavisualization.Diagram.Shapes.Basic;
            newComment.shape = ej.datavisualization.Diagram.BasicShapes.Path;
            newComment.pathData = "M0,10 L0,90 L10,100 L90,100 L100,90 L100,10 L90,0 L10,0 z";
            newComment.constraints = ej.datavisualization.Diagram.NodeConstraints.Default & ~ej.datavisualization.Diagram.NodeConstraints.Rotate & ~ej.datavisualization.Diagram.NodeConstraints.Connect;
            newComment.fillColor = "#8BA0B3";
            newComment.labels = [{
                text: "Comment",
                width: 80,
                height: 70,
                offset: {
                    x: 0.01,
                    y: 0.1
                },
                horizontalAlignment: ej.datavisualization.Diagram.HorizontalAlignment.Left,
                verticalAlignment: ej.datavisualization.Diagram.VerticalAlignment.Top,
                textAlign: ej.datavisualization.Diagram.TextAlign.Left,
                wrapping: ej.datavisualization.Diagram.TextWrapping.Wrap
            }];

            diagram.add(newComment);
        },

Attachment: commentHeight_21e30a95.zip

1 Reply 1 reply marked as answer

AR Aravind Ravi Syncfusion Team December 2, 2020 01:39 PM UTC

Hi DSoftware, 
 
We does not have support for the label locking in the diagram. However, by using the label constraints you can able to restrict the annotation editing. To set label as ReadOnly remove selectable constraints from the label constraints. So that you can able to edit the label. Please refer below code snippet 
 
label.Constraints = LabelConstraints.All & ~LabelConstraints.Selectable; 
 
Regards 
Aravind Ravi 


Marked as answer
Loader.
Up arrow icon