This is a migrated thread and some comments may be shown as answers.

Connection caption in Html.

2 Answers 52 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Mihail
Top achievements
Rank 1
Mihail asked on 28 Aug 2015, 02:44 PM
I try to export diagram to Html. But connection caption is hidden in .html file. How can i add connection caption into .html?

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 02 Sep 2015, 01:42 PM
Hello Mihail,

I guess you are using the implementation from the RadDiagram.js file demonstrated in the diagram-html-export example. If so, keep in mind that the RDImporter from the example doesn't implement drawing of the connection's Content. In order to display it you will need to implement custom javascript code in the RadDiagram.js file that creates the text element for the connection's content. For example, you can plug the creation of the content in the "createConnections" function.
RDImporter.prototype.createConnections = function (connections) {
    // some code
     
    for(var i = 0; i < connections.length; i++) {
     
        var connection = connections[i];
        var connectionProps = this.extractConnectionProperties(connection);    
        var startP = this.parsePoint(connectionProps.startpoint);
        var endP = this.parsePoint(connectionProps.endpoint);
         
        // some code
             
            if (connection.Properties["content"] != null) {
                 
                var content = connection.Properties["content"];            
 
                var text = new svg.TextBlock();
                 
                text.Text = content.trim();
                text.dx = 5;                       
                text.Background = "black";
 
                this.diagram.MainLayer.Append(text);                       
 
                var contentX = ((endP.x - startP.x) / 2) + startP.x;
                var contentY = ((endP.y - startP.y) / 2) + startP.y;
 
                var contentWidth = text.native.clientWidth;
                var contentHeigth = text.native.clientHeight;
 
                text.Position = new svg.Point(contentX - contentWidth / 2, contentY - contentHeigth / 2);
            }
 
        // some code
         
    }
};

Please let me know if this information helps.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mihail
Top achievements
Rank 1
answered on 07 Sep 2015, 09:35 AM
It's helped for me. Now connection's Сontent become visible on .html pages.
Tags
Diagram
Asked by
Mihail
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Mihail
Top achievements
Rank 1
Share this question
or