GraphStream Users

Archives de la liste Aide


Re: SVG Export Problems


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, Eduardo Lidanski <eduardo.lidanski AT pikolab.net>
  • Subject: Re: SVG Export Problems
  • Date: Wed, 13 Nov 2013 17:17:20 +0100

Hi,

Just create the SpringBox and add it as sink before creating the graph.
Or use the Toolkit.computeLayout(g); of the gs-algo module to compute the layout.

Regards.
Guilhelm


2013/11/13 Eduardo Lidanski <eduardo.lidanski AT pikolab.net>
Hi,

first of all thanks for this great library.
I am trying to export my graph to SVG but no success.
An example:

public class ExportTest {

    public static void main(String args[]) {

        DefaultGraph g = new DefaultGraph("export SVG");
        g.addAttribute("ui.quality");
        g.addAttribute("ui.antialias");

        g.addNode("A");

        g.addNode("B");

        g.addNode("C");

        g.addEdge("AB", "A", "B");

        g.addEdge("AC", "A", "C");

        g.addEdge("BC", "B", "C");

        g.display();
        String path = "export/graph.svg";

        FileSink out = new FileSinkSVG2();
         SpringBox sb = new SpringBox();
         g.addSink(sb);

         sb.addAttributeSink(g);
         sb.shake();
         sb.compute();

         while (sb.getStabilization() < 1) {
             sb.compute();
         }

        try {
            out.writeAll(g, path);
        } catch (IOException ex) {
            System.err.println(ex);
            return;
        }

    }

}

But I get the svg file attached, which is clearly not correct.

What am I doing wrong?

Thank you
Eduardo





--
Guilhelm Savin
PhD Student of Computer Science


  • SVG Export Problems, Eduardo Lidanski, 13/11/2013
    • Re: SVG Export Problems, guilhelm savin, 13/11/2013

Archives gérées par MHonArc 2.6.16.

Top of page