Hello,
I was able to change the label text successfully but no the text position.
I'm using :
kendoDiagram.connections[0].redraw({content: {text: 'myLabel', x: 20, y: 50}});
In fact, the position changes but temporary until:
- selecting other connection/shape
- clicking in the background of the diagram
- calling kendoDiagram.connections[0].refresh();
How can I proceed to change the position of the label please?
Best regards,
Seifeddine
6 Answers, 1 is accepted
I am afraid that this is not currently supported. The content position is automatically calculated and cannot be changed.
Regards,
Daniel
Telerik
Hello Daniel,
Thanks for your answer.
Actually, I can change its position but I'm asking how to keep it in the new position.
Is that possible?
Regards,
Seifeddine
Actually, the position being changed at all when using the redraw method is a bug that is fixed in the latest version. The built-in alignment was not performed when updating the content. It should be possible to keep the position set with the redraw method in the latest version by overriding the internal _alignContent method:
kendoDiagram.connections[0]._alignContent = $.noop;
kendoDiagram.connections[0].redraw({content: {text:
'myLabel'
, x: 20, y: 50}});
Regards,
Daniel
Telerik
Hello,
Thanks for this Daniel - this is what is needed.
What about resetting the _alignContent to the default behaviour after overriding it?
Regards,
Seifeddine
You could either keep a reference to the function or get a reference from the prototype:
kendoDiagram.connections[0]._alignContent = kendo.dataviz.diagram.Connection.fn._alignContent;
Regards,
Daniel
Telerik
Hi,
Thanks - the second option is the needed one.
Regards,
Seifeddine