i'd like to ask how can you make a label fit into a cell?Also,when how do we modify the shape of the cell.Using the given code


v0=graph.insertVertex(graph.getDefaultParent(), null,from, 0, 0,100,100,"shape=ellipse;perimeter=100;fillColor=green");


produces circular vertices.How do we make them elliptical.

asked 02 Jun '11, 12:00

ab3421's gravatar image

accept rate: 0%

Dou you mean word-wrapping or clipping to fit the label? For ellipses, change the width and height (100, 100) in the above call.

(02 Jun '11, 21:41) Gaudenz

Here it is the code you can use:\n

v0=graph.insertVertex(graph.getDefaultParent(), null,from, 0, 0,300,100,"shape=ellipse;perimeter=100;whiteSpace=wrap;fillColor=green")


In this way you'll have a cell with a width of 300 and an height of 100 (if you'll leave 2 identicals values you'll obtain a circular vertex).\nThe "whiteSpace=wrap;" parameter makes you wrap the text inside the vertex.


I don't know hot to obtain the word-clipping so if Gaudenz will tell us how to do it it's a good thing :)


answered 03 Jun '11, 00:32

vinnie's gravatar image

accept rate: 9%

Use "overflow=hidden" keep in mind that you need mxGraph.setHtmlLabels(true) for "whiteSpace=wrap"


answered 03 Jun '11, 00:36

Gaudenz's gravatar image

accept rate: 39%

Is mxGraph.setHtmlLabels(true) a default setting?


Beacause I didn't use it.

(03 Jun '11, 00:48) vinnie

Nope, did you try SVG-based browsers or just IE?

(03 Jun '11, 00:49) Gaudenz

Ooops. I'm sorry... I didn't noticed that it was JavaScript.


Reading what ab3421 wrotes I simply thought that v0 was an already initialized Object in Java.

(03 Jun '11, 00:54) vinnie
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 02 Jun '11, 12:00

Seen: 6,438 times

Last updated: 06 Jun '11, 12:29