Change the position of a connection label

7 posts, 0 answers
  1. Seifeddine
    Seifeddine avatar
    5 posts
    Member since:
    Feb 2015

    Posted 31 Aug 2015 Link to this post

    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].re​fresh();

    H​ow can I proceed to change the position of the label please?

    Best regards,

    Seifeddine

    In fact, the position  
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 02 Sep 2015 Link to this post

    Hello Seifeddine,

    I am afraid that this is not currently supported. The content position is automatically calculated and cannot be changed.

    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Seifeddine
    Seifeddine avatar
    5 posts
    Member since:
    Feb 2015

    Posted 02 Sep 2015 in reply to Daniel Link to this post

    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

  5. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 04 Sep 2015 Link to this post

    Hello,

    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}})​;
    but note that this is not recommended. 


    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Seifeddine
    Seifeddine avatar
    5 posts
    Member since:
    Feb 2015

    Posted 04 Sep 2015 in reply to Daniel Link to this post

    Hello,

    Thanks for this Daniel - this is what is needed.

    What about resetting the _alignContent to the default behaviour after overriding it?

    Regards,
    Seifeddine

  7. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 07 Sep 2015 Link to this post

    Hi,

    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
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Seifeddine
    Seifeddine avatar
    5 posts
    Member since:
    Feb 2015

    Posted 08 Sep 2015 in reply to Daniel Link to this post

    Hi,

    Thanks - the second option is the needed one.

    Regards,
    Seifeddine

Back to Top
Kendo UI is VS 2017 Ready