views:

337

answers:

3

I have data structured in Binary tree format, i want to represent it into an image(*. jpeg) then i need to display that image on web page and all the data will come @ runtime, so image processing should be done @ runtime, how to do this ?
This is what my thought solution any other suitable solution are also welcomed,
web site is in .NET , i am thinking to produce image using java api then integrate it to .NET wither through WEB-SERVICE call or any other solutions are also welcomed.

+3  A: 

Graphviz can convert structured data to a visual representation, including jpeg.

As the representations are usually line drawings, the results will probably look better if you use a non-lossy image format like PNG.

Graphviz comes with a tool called WebDot that (depending on where you are deploying things) might be useful.

Some example binary tree images produced by the tool can be seen here.

JGraph is also something that looks interesting, but I have no experience with it.

spong
I posted a less eloquent message about the same thing a minute before you, but I'll delete it and let you have the karma. :)
Gunslinger47
org.life.java
GraphicxViz sucks.. dot: error while loading shared libraries: libgvc.so.5: cannot open shared object file: No such file or directory
org.life.java
@Gunslinger47: Very gracious of you, and I appreciate it!
spong
@abc: Sounds like your `LD_LIBRARY_PATH` isn't quite right. On my machine (debian) the graphviz libs are in `/usr/lib/graphviz`, but they could easily be in `/usr/local/lib/graphviz` on your machine. Try to find them, and then use `LD_LIBRARY_PATH=/path/to/libs dot -Tpng btree.dot >btree.png`.
spong
spong
still same issue .
org.life.java
@abc: Even with the `--enable-static` version? I'm not sure how this could happen unless you are running a different `dot` executable from the one you think you are running.
spong
Thanks Spong. it worked. src:http://www.graphviz.org/cgi-bin/webdot/webdot/graphs/directed/tree.dot.srcand command i fired : dot -Tps 1.dot -o graph1.ps i got the required output in .ps file but how to get it in .jpeg ?
org.life.java
i removed all the things and worked installing using : sudo apt-get install graphviz
org.life.java
the problem here is my web host won't allow me to install GraphViz in server machine, so i will have to look for another solution.
org.life.java
can you suggest something ?
org.life.java
I'm not sure I can help you much more than this. If I had this problem, I'd probably go to http://freshmeat.net and/or http://sf.net and search for some libraries that might help.Alternatively, you could go to http://superuser.com and describe your web hosting environment and ask for solutions there. There might be some non-java solution (perl, python) that would work in your environment.
spong
Ok Spong Thanks really appreciate your help !!
org.life.java
but still i didn't get my answer!
org.life.java
A: 

When I created a binary tree for a financial algorithm i created it in SVG format and viewed in Firefox. You can create it in SVG and convert it to PNG with inkscape for example. SVG format is very simple to generate for well defined graph like binary trees. I do not suggest to use JPG as final format for web page. Images containing thin lines are better represented in lossless image formats like PNG.

Ross
which library u used for that?
org.life.java
No library. I have the binary tree structure, traverse it and generate XML, then add some header and footer XML to create SVG format.
Ross
+1  A: 

solution i found finally

org.life.java
That's pretty nice.
spong