sim51 / react-sigma

Sigma React component
https://sim51.github.io/react-sigma/
Other
158 stars 27 forks source link

Line breaks for long labels #69

Open pann-q opened 1 month ago

pann-q commented 1 month ago

Good day. Sigma must be able to do line breaks for long labels. For example, it can specify the maximum label length in the parameter

Is your feature request related to a problem? Please describe. We have very long labels and need to display them in several lines

Describe the solution you'd like It can specify the maximum label length in the parameter

Describe alternatives you've considered We tried adding \n, but it doesn't work

sim51 commented 1 month ago

Labels are displayed in canvas in sigma, and it uses the function filltext which doesn't support line breaks. So there is no native support for your need.

You can write your own label renderer which is simple, it's just one function. There is an example here :

You can do the same thing for the drawHover. It's what is used in the demo of sigma website