1

I create a vertex and put a value in it, showed as the vertex label. I need to make it with a tall height label and at the same time, small width, but when I set the "fontSize=44" at the vertex style, it also changes the width (obviously) of the label only, so the label has content out of the vertex bounds. Now I need to change the width value and don't know how. Any help?

Fagundes
  • 119
  • 10
  • Have you tried `mxGraph.setAutoSizeCells(true)`? – F. Lumnitz Nov 19 '15 at 12:18
  • @F.Lumnitz yeah, but the label still has content out of the vertex bounds :/ – Fagundes Nov 19 '15 at 15:05
  • Then try `mxGraph.updateCellSize(Object cell)`, this should update your node if you have `mxGraph.setAutoSizeCells(true)` set. If you want to change the size by yourself then have a look at `mxCell.getGeometry()` and `mxCell.setGeometry(mxGeometry)`. But always create a new `mxGeometry` or clone the old one, because otherwise the view won't notice the update – F. Lumnitz Nov 19 '15 at 15:20
  • @F.Lumnitz It actually updated the cell size, but it made the vertex bounds bigger instead of making the label inside of it smaller. Even if I create a new smaller geometry and update my cell geometry manually. – Fagundes Nov 19 '15 at 16:33
  • Also, my vertex is created with the exact size it must have. If there is a way to set the label style to fit the vertex entirely, without setting the font, it would be the best solution I guess. – Fagundes Nov 19 '15 at 17:14
  • Ah, you wan't the Text to be smaller. Hm, you can have a look at `mxUtils.wordWrap()`, maybe this can help you to split the Label into multiple parts – F. Lumnitz Nov 20 '15 at 08:17

0 Answers0