Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

javascript - Why can't I wrap my node label with text-overflow-wrap? cytoscape js (Random/Undefined characters show up instead of text)

I am trying to wrap the labels of the nodes in my graph using cytoscape js. I have done this: EDIT: So previously I was trying to wrap a string which didn't have any whitespaces. I learned that in order to wrap strings w/o whitespaces, I should use 'text-overflow-wrap' instead. Thus I used it below.

 style: [
            {
              selector: 'node',
             
                css: {
                'label': 'data(id)',
                'text-overflow-wrap': 'anywhere',
                'text-max-width': 1,
                'color': 'red'
                  }
            }
        ]

However, it does not work (I have put 1 to max-width for trying pruposes). After doing it, the label turns into gibberish. What I mean is it gets displayed like this:

a€ma€...

I know the css paranthesis work because when I change the labels' color, they do change. However, I could not wrap them. What I want to do is, if the label is too long just wrap it to a new line. And here is the official documentation that tells how to wrap the labels: https://js.cytoscape.org/#style/labels

Thank you!

question from:https://stackoverflow.com/questions/65921912/why-cant-i-wrap-my-node-label-with-text-overflow-wrap-cytoscape-js-random-und

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...