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

I have a graph with a group of barcharts, I want each bar (column) to get a point on it. ie. I have: However, given code like this:
my $gd = $graph->plot( [ \@labels, @bar_series, \@bar_points ], );
I end up with *one* point on each bar chart grouping, rather than a point per bar. It doesn't look like GD::Graph is flexible enough to do this, so I started looking in to how to hack the image that GD::Graph is creating directly, so that I can draw my own arc() with GD.

However, I can't see how to do this, ie. I'm not sure how to "intrude" into GD::Graph's instance of GD to make a call to arc().

Any advice would be appreciated - either about how to do this properly with GD::Graph, or how to hack GD::Graph's GD to do it with GD.

thanks!
Nathan

Replies are listed 'Best First'.
Re: Customising GD::Graph output
by zentara (Cardinal) on Aug 07, 2011 at 16:35 UTC
    you're still welcome to tell me a smarter way....like FilledEllipse

    For filled ellipse, see Re: need advice on how to create venn diagram program

    If you really want to make alot of specialized, customized graphs, you are best off going with a bigger toolkit, like CairoGraphics. There is a Perl module for it, Cairo.

    If you want a Cairo based graphing program, look at the examples for Gnuplot and PLPlot. They have little scripts to generate all sorts of shapes and output. You can run both from Perl.

    Of course, they don't beat GD::Graph for simplicity and convenience.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Customising GD::Graph output
by natebailey (Acolyte) on Aug 07, 2011 at 14:04 UTC
    And the answer is - use $graph->gd, ie:
    my $real = $graph->gd; my $red = $real->colorAllocate(255,0,0); $real->arc(290,150,10,10,0,360,$red);
    (of course, you're still welcome to tell me a smarter way :-)
      (liked filledEllipse :-)