Blog Closed

This blog has moved to Github. This page will not be updated and is not open for comments. Please go to the new site for updated content.

Thursday, January 31, 2008

Displaying graphs

My Expert System shell produces graph objects using the Graph::Easy module. I could probably switch over to using the regular flavor of Graph, but for now I'm not. Graph::Easy has the option to output into GraphViz, SVG, and HTML outputs. What I want is the ability to display one of these graphs in my Tk program, without having to open an external file viewer.

There are two possible paths to take: I can find a way to convert the SVG output to an image format (JPEG or PNG should be fine) and then display the image file, or I can find a widget that can natively display SVG images.

One requirement that I have (it's a firm requirement, although not an absolute one) is that I would like to try to find a pure-perl solution, or at least a solution that doesn't require me to compile any XS code. There are many reasons for this, and I won't take the time to explain them all here. Eventually I'm going to switch to Strawberry Perl, and will probably lift this restriction.

Tk::Zinc, and SVG::SVG2Zinc seemed like a good combination, but ActiveState doesnt offer either in it's download repository. It also doesnt offer Tk::HyperText (which should be able to render the HTML output versions of my graphs), or Tk::GraphViz. This would seem to indicate that I can't find an (easy) solution involving just Tk widgets.

I also haven't been able to find a satisfactory solution for converting GraphViz, SVG, or HTML into an image file. Of course, maybe I haven't been searching hard enough, or looking for the right keywords. Many of the modules I do find for this purpose are based on compiled libraries such as GD, LibRSVG, Cairo, etc. SVG::Convert, which seems to have a PNG output mode, isn't downloadable from activestate. SVG::GD is available for download, but relies on GD which is not. GD::SVG isn't available either, but it doesnt look like that library supports what I want to do anyway.

I'll keep looking, this is the first day of my search and I'm not putting a lot of effort into it.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.