When creating a vertex with text in the value it put a couple pixels above the middle. Different font sizes are at different heights. The Text is also smaller than the font size I enter. How would I get the text centered in the cell?
This is the Stylesheet I use.
int TFontSize = 15;
mxStylesheet stylesheet = graph.getStylesheet();
Hashtable<String, Object> style = new Hashtable<String, Object>();
style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
style.put(mxConstants.STYLE_FILLCOLOR, "white");
style.put(mxConstants.STYLE_STROKECOLOR, "black");
style.put(mxConstants.STYLE_FONTCOLOR, "black");
style.put(mxConstants.STYLE_FONTFAMILY, "Arial");
style.put(mxConstants.STYLE_FONTSIZE, TFontSize);
stylesheet.putCellStyle("teamS", style);
This is the code where the cells are created
for (int j = 0; j < matches.get(i).teams.size(); j++) {
//gets string of team
String teamName = matches.get(i).teams.get(j).name;
//team names get put into multiple lines
String teamWrapped = WordWrap.from(teamName).maxWidth(cellSize / 5).insertHyphens(true).wrap();
//location of vertex
int cellX = (hCellSpace / 2) + (j / rows * (cellSize + hCellSpace));
int cellY = (titleSize) + ((j % rows) * (cellSize + vCellSpace));
//style for vertex
String cellStyle = "teamS;";
//creates vertex
Object cell = graph.insertVertex(base, null, teamWrapped, cellX, cellY, cellSize, cellSize, cellStyle);
}
style.put(mxConstants.STYLE_VERTICAL_ALIGN, "ALIGN_TOP");
then add
";spacingTop=" + (cellSize + 3)
to the style