Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



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 Anonymous Coward on Sunday April 29, 2007 @12:54PM (#18919379)
    When will open source advocates learn to delegate the graphic design aspect of their work to professionals? Plenty of designers would be more than happy to contribute, if only the programming types in charge of these projects would admit they're better at making code than graphics.
  • ChartDirector (Score:3, Interesting)

    by rishistar ( 662278 ) on Sunday April 29, 2007 @01:44PM (#18919683) Homepage
    I was looking for graphing and charting stuff last year. The only thing I found at the time was ChartDirector [advsofteng.com]. There have been a couple of other open source ones posted above that I may investigate in future, but finding this was what I needed at the time.
  • Re:Don't get it.. (Score:3, Interesting)

    by Bodero ( 136806 ) on Sunday April 29, 2007 @01:48PM (#18919719)
    Agreed. I had the same problem not too long ago about making dynamic charts that look professional.

    My solution was to use Perl and Win32::OLE to interface with Excel 2003 using VBA scripting within Perl. Sure, it's a Windows-only solution, and it's not open source, but it was an intranet problem that needed to be solved.
  • Re:Don't get it.. (Score:2, Interesting)

    by vk2 ( 753291 ) on Sunday April 29, 2007 @02:14PM (#18919883) Journal
    Have you seen this? http://www.advsofteng.com/ [advsofteng.com]
  • by suv4x4 ( 956391 ) on Sunday April 29, 2007 @04:01PM (#18920611)
    The examples I can find in flash are 1-2 liners in R. Seriously, plotting a bar graph or pie graph or scatter plot is 2 lines (1 line input the data, 1 line to plot the graph.) Now, do something complicated and interesting as shown above. Do a multi-dimensonal plot. Do a box and whiskers plot (again, a 1 liner in R) that calculates medians, quartiles, etc.

    Lookup Flex Charts. An open-source Flash library for rendering charts, by Adobe.

    It can renders charts if you just feed it the data (in XML format) and what chart type you want.
  • by matt me ( 850665 ) on Sunday April 29, 2007 @04:28PM (#18920841)
    Those charts look pretty hot to me. Did you look at the chart in the page? http://www-128.ibm.com/developerworks/opensource/l ibrary/os-perlgdchart/pie_step1_step2.gif [ibm.com]
    ). Anti-aliased lines and text :]

    Let's compare this to what I'd get if I asked most professionals for a chart. (These were the first ones from google). The lack of anti-aliasing hurts one's eye, these all look like they're from 1995.
    http://support.alphasoftware.com/images/XD_Interac tive_Pie_Chart.gif [alphasoftware.com]
    http://msdn2.microsoft.com/en-us/library/aa192481. odc_vststockallocation2003_fig03(en-us,office.11). gif [microsoft.com]
    (the second one is 3d)

    And in response to your comment
    > When will open source advocates learn to delegate the graphic design aspect of their work to professionals? if only the programming types in charge of these projects would admit they're better at making code than graphics.
    You seem to have missed the point. The article is about free software that can be used by professional and non-professional alike to create some hot graphics. Perhaps you're referring to the ugliness of the original tux logo? It's not 1995, and developers aren't resigned to producing their own graphics. If you look all free software houses pushing their brand use professional designers. Think of the firefox logo (2004)
    http://www.hicksdesign.co.uk/journal/branding-fire fox [hicksdesign.co.uk]
    or of ubuntu and gnome's curves, and check out the tango project http://tango.freedesktop.org/ [freedesktop.org]
    Desktop linux has never looked so sexy.

    Why so sour, AC?
  • Re:wow! (Score:2, Interesting)

    by choongiri ( 840652 ) on Sunday April 29, 2007 @05:07PM (#18921125) Homepage Journal

    > Anyone have better solutions?

    Yes.

    eZComponents Graph [ez.no], from the developers of the eZpublish CMS. It's FLOSS, easy to use, and works very well for some automatically generated graphs [carroll.org.uk] I made that needed to update every week.

  • by glwtta ( 532858 ) on Sunday April 29, 2007 @07:10PM (#18922085) Homepage
    I do most of my work in Perl, and the lack of a good chart package has been annoying for a very long time. GD::Graph will give you very basic (and not terribly ugly) line and bar charts relatively quickly, but that's about it; it's missing even rudimentary features that make it less than useful (eg error bars).

    There just isn't a general purpose charting package for Perl that would even come close to JFreeChart [jfree.org]. Grace [weizmann.ac.il] 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).

    So, if you want publication quality charts you basically still have to learn gnuplot, which is great, but sometimes just a little too involved.

    At least this thread gives a nice summary of what the other languages have to offer: the PHP [aditus.nu] and Ruby [nubyonrails.com] packages aren't faring any better, but Python's matplotlib [sourceforge.net] looks freaking beautiful.
  • Re:wow! (Score:5, Interesting)

    by Andy Dodd ( 701 ) <atd7NO@SPAMcornell.edu> on Sunday April 29, 2007 @08:50PM (#18922685) Homepage
    octave + gnuplot + LaTeX = absolutely beautiful plots in anything I submitted (homework assignments, term papers) in grad school.

    To get you started (there could be errors here, I'm doing this from memory, but Octave code something similar to this:

    plot blah
    hold on
    plot something
    plot otherstuff
    hold off

    gset term postscript eps color 22
    gset output someplot.eps

    replot

    gset output foo %bad shit happens to your plot output if you don't change the output file when setting the term back to X11
    gset term x11

    Would do the following:
    Plot multiple things in a plot to the screen
    Output that plot to an EPS file
    Reset the output so the next plot would go back to the screen

    You could then run the .eps files through epstopdf, write some document in LaTeX that included your plots by their basename (i.e. without the .pdf extension in the document), and use pdflatex to generate a nice PDF file complete with clickable cross references

    (There are a lot of details I'm not mentioning here of course, unfortunately there really isn't any single good central HOWTO for doing all sorts of useful stuff in LaTeX.)
  • Re:wow! (Score:3, Interesting)

    by zippthorne ( 748122 ) on Sunday April 29, 2007 @10:44PM (#18923367) Journal
    Indeed. Also, Matlab runs on linux, and has latex pretty-print modes. So you don't have to get all confused learning the quirky similarities between Octave and Matlab is you don't want to.

    And LyX is very convenient. Especially for typesetting those pesky equations. Much less flaky than MS Office, or even OO.org. In fact, I'd classify its equation modes as not flaky at all. Of course, it's convenient that anything they don't support can simply be escaped and typed in pure latex...

    My favorite thing about LyX is that even if you have a lot of pictures and included files, when you insert new elements, old elements (like graphics or text-boxes) don't go flying all over the document depending on how you've anchored them.

For God's sake, stop researching for a while and begin to think!

Working...