Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

Custom Charts w/ Perl and GD 112

An anonymous reader writes "This article describes techniques you can use to create new levels of usefulness in your dynamically generated charts with Perl and GD. Cook up some automatically generated graphs for your organizational meetings or live enterprise directory data. Annotate the charts with readable text that delivers more information than the standard pie chart. Using the power of GD and Perl, you can link various data and images together to create sophisticated charts that will help bring visual interest to your applications."
This discussion has been archived. No new comments can be posted.

Custom Charts w/ Perl and GD

Comments Filter:
  • by MarkEst1973 ( 769601 ) on Sunday April 29, 2007 @01:16PM (#18919507)
    ... there's matplotlib [sourceforge.net] and there's reportlab [reportlab.org] for PDFs. Both are excellent open source packages, and I can tell you from experience that reportlab has outstanding support. I recently posted a question to their mailing list and received three intelligent replies within an hour.
  • by dbcad7 ( 771464 ) on Sunday April 29, 2007 @01:22PM (#18919531)
    I think the examples are meant to show how it works, not to wow you with art.

    The code looks easy enough to experiment with your own artwork, so I look forward to seeing how much better you can do.

  • Re:wow! (Score:5, Informative)

    by Coryoth ( 254751 ) on Sunday April 29, 2007 @01:29PM (#18919587) Homepage Journal

    For those of us who just want to generate some simple graphs for papers and such, what do people use? I've messed with Excel, gnuplot, R, and now I'm using ploticus. Anyone have better solutions?
    To be honest I would suggest you try messing with Gnuplot some more -- it is actually a lot better, and produces much nicer plots, than it seems at first. The trick is to use a different terminal type than "x11", which is pretty crappy; the output looks remarkably different if you use "png", "svg" or "postscript". Here are some examples of plots I've done with Gnuplot: [1] [wikipedia.org], [2] [wikipedia.org], [3] [wikipedia.org] [4] [wikipedia.org] (for the last link, note that vertical text alignment renders fine in inkscape, just not on Wikipedia -- download the svg file to see).

    If that's still not tickling your fancy then I would suggest matplotlib [sourceforge.net] which is actually pretty versatile, and produces good looking plots. There's also PyX [sourceforge.net] if you're looking for slightly more raw graphical interaction with nice output. Truth be told, however, after messing around with many of the same options you have, I've found that Gnuplot, once you get over the initial learning hurdle and figure out how to turn out nice looking plots, is the fastest and easiest way to turn out plots and charts.
  • Ruby / Gruff (Score:3, Informative)

    by carlivar ( 119811 ) on Sunday April 29, 2007 @02:01PM (#18919801)
    Or use Ruby [ruby-lang.org] with Gruff [nubyonrails.com].
  • Use JPGraph instead (Score:3, Informative)

    by yahyamf ( 751776 ) * on Sunday April 29, 2007 @04:37PM (#18920917)
    JPGraph [aditus.nu] uses PHP and GD, and they have dozens of very fancy graphs along with excellent documentation and code examples. You can have beautiful looking graphs in a few minutes with less than a screen full of php code.

    I think it's dual licensed, with a very modest fee for commercial use.

  • by LordLucless ( 582312 ) on Sunday April 29, 2007 @04:42PM (#18920955)
    You don't. You use a library like GD and a scripting language to generate the charts as images(alternatively, if your chart is representing static data, you can just whip up a static image in excel/gnuplot/whatever). There are also libraries built on top of GD (I use jpGraph with PHP) which simplify the process.

    You can probably emulate a bar graph using tables, if you're particularly anal about doing it in HTML. Hell, you could probably do a line graph with a whole tonne of 1-pixel cells in a table, but I wouldn't recommend it.
  • by Noksagt ( 69097 ) on Sunday April 29, 2007 @08:27PM (#18922557) Homepage

    Grace can produce some nice results, but the Perl interface to it is just a wrapper around their terrible command line interface (maybe it's improved in the last few years, but when I tried it it was almost entirely undocumented and nigh-unusable).
    I like grace a lot. I use it through the GUI & occasionally through python, so can't comment extensively on the perl interfaces. Neither Chart::GRACE [cpan.org] nor Chart::Graph::Xmgrace [caida.org] seem TOO obscure.

    The command line interface of grace isn't terrible--it is MUCH more powerful than most plotting software which has a GUI. I do agree it is under-documented, though. Fortunately, the developers are very responsive in the forums [weizmann.ac.il].
  • Re:wow! (Score:3, Informative)

    by T-Ranger ( 10520 ) <jeffw@cheMENCKENbucto.ns.ca minus author> on Sunday April 29, 2007 @09:06PM (#18922787) Homepage
    Its not GNUPlot. Gnuplot, or gnuplot, sure. But it has exactly nothing to do with GNU.
  • by Anonymous Coward on Monday April 30, 2007 @08:33AM (#18926299)
    Some of the open source JavaScript toolkits can be used to draw charts on a browser window with inline SVG and VML. This makes it possible to draw charts on the web browser instead of having the web server draw them.

    Some examples:
    Dojo Toolkit [ajaxian.com]
    I think I've seen a live charting demo on Dojo's official website, but it seems to be no longer there.

    WT Toolkit [sourceforge.net]
    This one seems to be a new project, judging from the activity charts on their SourceForge page [sourceforge.net]. The way they can draw 3D charts (like, pie charts, 3D bar charts) with inline SVG and VML is quite amazing though.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...