- From: Dave Murray-Rust <d.murray-rust AT ed.ac.uk>
- To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>
- Subject: Re: Exporting SVG
- Date: Fri, 30 Aug 2013 14:38:47 +0100
Hi, thanks for the FileSinks suggestion, I've been experimenting, but haven't
found a good solution.
I'm making my graph and screenshots like this:
val graph = Graphs.synchronizedGraph( new MultiGraph("Messages") )
...
val fs = new FileSinkSVG2
fs.writeAll(graph,file)
The results are:
* If I use FileSinkSVG, I get a broken SVG file - it's missing the closing
tag, and just seems to have some lines in. (attached)
* If I use FileSinkSVG2, it falls over on dynamic styles - appears to be an
issue in the colour calculation code[1]
* If I get rid of the dynamic styles, I get an SVG, but without any text, and
at least some of the styling is not done (e.g. edges are not coloured).
(attached)
* If I use FileSinkImages, I get PNGs, but the rendering is quite different
to onscreen - I can give more details if useful.
* If I use renderer.screenshot("output.png"…), then it works fine, and I get
lovely pictures - but I'd like to get SVGs.
It looks to me like the renderer.screenshot method will generally provide
more accurate reproductions, as it's using exactly the same rendering code
rather than trying to maintain a duplicate copy - I guess it's the dependency
on Batik that makes it less desirable?
Thanks!
dave
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


[1]
[WARNING] no x attribute for node "created_1" false
[WARNING] no x attribute for node "created_1" false
[WARNING] no x attribute for node "created_1" false
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2,
Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at
org.graphstream.stream.file.FileSinkSVG2$SVGStyle.getElementStyle(FileSinkSVG2.java:804)
at
org.graphstream.stream.file.FileSinkSVG2$SVGContext.writeElement(FileSinkSVG2.java:348)
at
org.graphstream.stream.file.FileSinkSVG2$SVGContext.writeElements(FileSinkSVG2.java:318)
at
org.graphstream.stream.file.FileSinkSVG2.writeAll(FileSinkSVG2.java:157)
at
org.graphstream.stream.file.FileSinkSVG2.writeAll(FileSinkSVG2.java:120)
at
com.moseph.scalsc.visualisation.GraphstreamMessageGraph$class.screenshot(GraphstreamGraph.scala:59)
at
com.moseph.scalsc.visualisation.MessageSequenceDisplay$.screenshot(MessageSequence.scala:15)
at
com.moseph.scalsc.informal.semantics.TwitterSemanticiserRunner$delayedInit$body.apply(TwitterSemantics.scala:49)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at
scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.collection.immutable.List.foreach(List.scala:318)
at
scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.App$class.main(App.scala:71)
at
com.moseph.scalsc.informal.semantics.TwitterSemanticiserRunner$.main(TwitterSemantics.scala:24)
at
com.moseph.scalsc.informal.semantics.TwitterSemanticiserRunner.main(TwitterSemantics.scala)
On 30 Aug 2013, at 11:32, Dave Murray-Rust
<d.murray-rust AT ed.ac.uk>
wrote:
>
I've been trying to use renderer.screenshot(file,width,height), as I got
>
the impression from the docs that this was the best way to do things.
>
Should I be using the FileSink methods?
>
>
Versions:
>
<dependency>
>
<groupId>org.graphstream</groupId>
>
<artifactId>gs-core</artifactId>
>
<version>1.2</version>
>
</dependency>
>
<dependency>
>
<groupId>org.graphstream</groupId>
>
<artifactId>gs-ui</artifactId>
>
<version>1.2</version>
>
</dependency>
>
>
Thanks!
>
dave
>
>
On 30 Aug 2013, at 10:32, guilhelm savin
>
<guilhelm.savin AT gmail.com>
>
wrote:
>
>
> Hi Dave, and thanks
>
>
>
> There should not have such deps.
>
> Which version of gs-core are you using? And which sink? FileSinkSVG or
>
> FileSinkSVG2?
>
>
>
> Regards
>
> Guilhelm
>
>
>
>
>
> 2013/8/30 Dave Murray-Rust
>
> <d.murray-rust AT ed.ac.uk>
>
> I'd like to export SVG from graphs. Looking at the code, it seems like
>
> there is stuff in place to do this. However, I'm missing
>
> org.graphstream.ui.batik.BatikGraphics2D, and it doesn't seem to be in the
>
> source repo.
>
>
>
> Where can I find this?
>
>
>
> Cheers,
>
> dave
>
>
>
> p.s. - thanks for a fantastic library, really enjoying using it!
>
> --
>
> The University of Edinburgh is a charitable body, registered in
>
> Scotland, with registration number SC005336.
>
>
>
>
>
>
>
>
>
> --
>
> Guilhelm Savin
>
> PhD Student of Computer Science
>
> LITIS, University of Le Havre
>
> \/\/\/\/\/\/
>
> http://gsavin.lewub.org
>
> http://d3-project.org
>
> http://iscn.univ-lehavre.fr
>
> http://graphstream-project.org
>
> /\/\/\/\/\/\
>
Archives gérées par MHonArc 2.6.16.