グラフストリームでグラフを作成し、FileSinkSVG2 を使用して結果を svg ファイルに書き込みます。うまくいきます。唯一の問題は、エッジの端にある矢印が css 定義に従って表示されないことです。助言がありますか?これが私のコードです。
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
String path = "C:\\test.svg";
Graph graph = new MultiGraph("GraphStream");
graph.addAttribute("ui.stylesheet", "url('https://www.test.de/graph.css')");
Layout layout = new HierarchicalLayout();
graph.addSink(layout);
layout.addAttributeSink(graph);
setGraphValues(resultMap, graph);
layout.compute();
while (layout.getStabilization() < 1) {
layout.compute();
}
FileSinkSVG3 svg = new FileSinkSVG3();
try {
svg.writeAll(graph, path);
} catch (IOException ex) {
logger.info(ex.getMessage(), ex);
return;
}
CSS ファイル:
graph {
fill-color: white;
}
node {
size: 100px, 50px;
shape: rounded-box;
fill-color: white;
stroke-mode: plain;
stroke-color: red;
text-visibility-mode:normal;
text-color:black;
text-background-color:white;
text-style:normal;
text-alignment:center;
text-size:18px;
}
edge {
arrow-shape:arrow;
arrow-size: 3px, 2px;
shape: line;
size: 2px;
fill-color: red;
}