1

我正在使用 graphstream 创建一个图形,并使用 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;

}
4

1 回答 1

0

乍一看,FileSinkSVG2 似乎不支持自定义边缘,包括箭头和形状。您可以在github中打开一个问题,或者在拉取请求中提出您自己的实现。

于 2020-03-10T16:00:43.200 回答