in reply to perl Graph x_label_skip

cdial:

The Graph module doesn't draw/render graphs, with or without labels. Why not:

  1. specify the full name of the module you're talking about, and
  2. give us a short bit of code that exemplifies the problem

Then we might be able to assist.

...roboticus

Replies are listed 'Best First'.
Re^2: perl Graph x_label_skip
by cdial (Initiate) on Aug 17, 2009 at 13:10 UTC
    package Ari::Graph; use GD::Graph::hbars; use GD::Graph::bars; my @data = ('bob', 'carol', 'alice',5.55,0,0,54.43.0.65.83,0,18.21,0,0,17.29,0); my $graph = new GD::Graph::hbars(400,425); $graph->set(x_labels_vertical =>0, valign => '1', x_label_skip =>2) $graph->plot(\@data) or die "Graph Error"; The x_label_skip =>2 will get rid of the line label for carol and the horizontal graph line goes away. I'd like to keep the line label of carol and remove the horizontal line in the graph. Not the data line but the grid line. Thanks, Chuck Dial
      cdial:

      I pasted the code into a text window, but it doesn't compile. I fixed the obvious errors, getting:

      #!/usr/bin/perl -w use strict; use warnings; package Ari::Graph; use GD::Graph::hbars; use GD::Graph::bars; my @data = ('bob', 'carol', 'alice', 5.55, 0, 0, 54.43.0.65.83, 0, 18. +21, 0, 0, 17.29, 0); my $graph = new GD::Graph::hbars(400,425); $graph->set(x_labels_vertical =>0, valign => '1', x_label_skip =>2); $graph->plot(\@data) or die $graph->error;

      But when I run it, I get the error:

      roboticus@B001C23219B6C /Work/Perl/PerlMonks [11:03:17] $ ./789153.pl No attribute 'valign' Invalid data set: 0 at ./789153.pl line 13.

      If you get me a better bit of sample code, I'll be happy to take another look at it...

      ...roboticus
        #!/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);
        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);