1

I am using jgraphx library to draw some graphs in java. After zooming the graph, the edges become more thick. So i want to make the change of the sizes (or thikcness) of the edges dynamically with the scale zoom. My question is how can i change the size(or the thickness) of an edge in jgraphx library?

1 Answers1

1

The way I have done this in the past is to redraw the edge using mxGraph.insertEdge(), and passing "strokeWidth" as the "Style" parameter; the greater the number the thicker the edge.

mxGraph.insertEdge(mxGraph.getDefaultParent(), "id", "value", "source", "target", "strokeWidth=5;");

Alternatively, if you can grab the existing edge and cast it as mxCell, then you can invoke the setStyle() method on it which should do the same thing.

final Object[] childCells = getChildCells(mxGraph.getDefaultParent());
IntStream.range(0, childCells.length).forEach(i -> ((mxCell)childCells[i]).setStyle("strokeWidth=5;"));
Dan Beavis
  • 31
  • 3