kendo diagram visual fucntion text block overflow problem

1 Answer 25 Views
Diagram
BAOBAB
Top achievements
Rank 1
BAOBAB asked on 12 Dec 2023, 01:56 AM

Hello Telerik

First check this example : https://dojo.telerik.com/oraZInUQ

Q1. When constructing a diagram like this, if the length of the textblock text becomes larger than the length of the rectangle, is there a way to control this? I wish there was a line break.

Q2. The length of the text is longer, so the selection area for the shape has increased. I want the selection area to be based on the width and height of the rectangle. Is it possible to adjust the selection area of ​​shape?

Thank you for your reply.

1 Answer, 1 is accepted

Sort by
1
Accepted
Nikolay
Telerik team
answered on 14 Dec 2023, 11:47 AM

Hello JunBeom,

You can implement custom line breaks for the text. For example:

        var arrStr = [];
        //line breaks for text longr than 25 characters
        if(dataItem.text.length > 25) {
          for (let i = 0; i < dataItem.text.length; i=i+25) {
            layout.append(new diagram.TextBlock({
              text: dataItem.text.substr(i, 25)
            }));
          }
        } else {
          layout.append(new diagram.TextBlock({
            text: dataItem.text
          }));
        }

Dojo demo: https://dojo.telerik.com/oraZInUQ/2

Regards,
Nikolay
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
BAOBAB
Top achievements
Rank 1
commented on 19 Dec 2023, 06:37 AM

Thanks for your reply.

Q1. The problem has been resolved.

But Q2. How to solve the problem?

Nikolay
Telerik team
commented on 22 Dec 2023, 08:05 AM

Hi, JunBeom,

I think the second problem is resolved with the first one. After the text is broken into a few lines the shape itself is shortened.

Apart from that you can pass width to the Rectangle.width property to modify the shape width, however, the selection area will still remain calculated according to the text.

Regards,

Nikolay

Tags
Diagram
Asked by
BAOBAB
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or