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

Hi dear wise ones
I'm creating mixed graphs (more or less as described here, and i'm facing the same problems. As dragonchild noted, Support for mixed graphs is less than optimal, well it's far less than optimal.
I'm wondering if theres an alternative for creating good mixed graphs in perl, i've seen Image::Magick::Chart, but that creates horizontal bars only, and this is commercial.
Any good alternative / idea would be appriciated. (and it does not need to be perl, as long as i can create graphs with it for my website).
Thanks!

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Replies are listed 'Best First'.
Re: Alternative for GD::Graph?
by hossman (Prior) on Nov 25, 2005 at 09:02 UTC

    Try gnuplot, or perhaps Chart::Graph::Gnuplot - i'm not sure if the later supports all the options you'll need.

    Learning to use gnuplot for the first time is like learning perl -- you can accomplish alot very quickly, but a lot of what you do will work for reasons you don't understand, and you can use it for years without realizing there are easier/cleaner/better ways of doing the same thing.

    It should be able to do exactly what you want - you can plot damn near anything, in all sorts of styles.

Re: Alternative for GD::Graph?
by jbrugger (Parson) on Nov 25, 2005 at 09:57 UTC
    ah! that's what i need! Thanks!
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: Alternative for GD::Graph?
by Moron (Curate) on Nov 25, 2005 at 10:04 UTC
    Additionally, there's the java class library for charting jfreechart, although I would advise against trying to mix java and cgi on the same webpage - it isn't worth the grief.

    -M

    Free your mind

Re: Alternative for GD::Graph?
by ChemBoy (Priest) on Nov 25, 2005 at 22:42 UTC

    If what you're looking for is just a reference line, it'd be pretty easy to hack in, I think. There may be a bug or two in this (though it works in a trivial test case), but I'd think something along these lines would work:

    # assuming $graph has already been set up and plotted my $y_value = 42; # desired y-value for reference line my $y_coord = ( $graph->val_to_pixel(0,$y_value,0) )[1]; my $GD = $graph->{graph}; my $red = $GD->colorResolve(255,0,0); $GD->line($graph->{left},$y_coord,$graph->{right},$y_coord,$red);

    Not that I've been thinking about precisely that problem, recently, or anything like that. ;-)



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders