in reply to Re^3: perl Graph x_label_skip
in thread perl Graph x_label_skip

Sorry about the code display. I put the recommended code brackets around it and it looks better now.
#!/usr/bin/perl package Ari::Graph; use strict; use GD::Graph::hbars; use GD:: Graph::bars; my @data = (['bob','carol','alice], [5.55.6,7]); my $graph = new GD::Graph::hbars(400,425); $graph->set(long_ticks=>1, x_label_skip=> 2) or warn "Error"; $graph->plot(\@data) or die "Graph Error"; print "Content-type: image/jpeg\n\n"; print $graph->gd->jpeg(200);

Replies are listed 'Best First'.
Re^5: perl Graph x_label_skip
by roboticus (Chancellor) on Aug 17, 2009 at 16:39 UTC
    cdial:

    I haven't found an exact way to do it, but I notice that GD::Graph::bars/hbars uses GD::Graph::axestypes, which has plenty of options. Some of them look suggestive of ways to leave the axes out (look over the source code for comments & usage & such):

    • x_long_ticks: Do you want ticks to span the entire width of the graph?
    • x_ticks: Do we want ticks on the x axis?
    • x_tick_offset: Force the line to be drawn off the chart?
    • no_axes: Disable axes?

    Some combination of these might do the trick for you, or you may see other things to try. You might even patch the class and contribute your patch back to the author, so others may use it.

    BTW: You also ought to use cut & paste to get your code and error messages. It's much more accurate than retyping. (Example: You left out the closing quote after alice, and put a blank in "GD::Graph::bars".)

    ...roboticus