http://qs321.pair.com?node_id=515839

gianni76 has asked for the wisdom of the Perl Monks concerning the following question:

I need to be able to write a small program which does some display of simple x-y data.

I have seen the wonders of RRD, but I consider this not very portable and too complex, as it needs compilation and I have to work on multiple machines with no easy access to root permissions. The servers in general do not have access to GD or Imagemagik or anything like that and can be both win32 and linux.

What I would need is a module in pure perl which helps with basic line graphs with no installation requirements (just dump in the release directory and 'use' it from the perl script).
I can insert a series of files on the main directory of my program, but not much more.

The approach taken here: http://www.gerd-tentler.de/tools/perlgraphs/ is exactly what I would need. They have written a small .pm library with most of the functions to do simple but effective displays of graphs. Just their library is only for histograms/pie charts, while I would need some form of line plotting (x-y representation of data).

I would also be prepared to use GD if there was a way to make it portable, i.e. add max 5 library files to the release directory of my script with GD libraries, but am not sure if this is possible.

Any help or suggestions? Probably someone must have written something before the success of GD around.... x-y charting is so useful!

Edit: g0n - linkified link

Replies are listed 'Best First'.
Re: Portable simple line graph module?
by valdez (Monsignor) on Dec 11, 2005 at 15:41 UTC

    Ciao Gianni,
    i would try with SWF::Chart, it produces data that can be plotted in a variety of ways from an SWF file; see XML/SWF Charts Gallery for some examples. Unfortunately the Flash part is not open source, but it works really well and the licence is not expensive; there is also a free version with some limitations.

    There are also SVG::TT::Graph or SVG::Template::Graph, but in that case you will need an SVG capable browser.

    Ciao, Valerio

Re: Portable simple line graph module?
by gu (Beadle) on Dec 11, 2005 at 14:38 UTC
    For this kind of problem, I interface perl with gnuplot, ie I treat data and generate gnuplot command files with perl and then create postscript pictures using gnuplot.

    Hope this helps.
    Gu
      Hi, I understand your suggestion, but this does not solve the real problem I have, i.e. the portability. gnuplot needs to be installed as well and even more in a win32 environment you need execution (.exe) permissions (which not everyone gives)! A more portable solution I was working on some time ago was with the precompiled versions of netpbm, but I could not use it on some win webspaces as they are blocking .exe files...

      This is the reason of my request to have something simple and portable (pure perl, with some intelligent html as done in the chart plotting module)!
Re: Portable simple line graph module?
by moklevat (Priest) on Dec 11, 2005 at 22:21 UTC
    I'm not certain if this will meet your needs but PGPLOT does scatter plots by calling the PGPLOT fortran libraries. Since pre-built Win32 PGPLOT libraries are available it may be a viable option for a portable solution.

    Also, FWIW I have used SVG::Graph to create scatter plots, but as valdez noted, you will have to deal with the SVG output.

Re: Portable simple line graph module?
by renodino (Curate) on Dec 12, 2005 at 00:07 UTC
    Just how simple do you need ? Text::Graph may be all you need (plus some <pre> tags). I don't think it has any prereq modules.