in reply to Two questions for GD::Graph

As for the grid, maybe you want long_ticks? (or x_long_ticks and y_long_ticks to set them separately)

I'm not sure if you can print the labels slanted (actually, I'm afraid you can't without hacking the source1), but for long labels there's x_labels_vertical.

___

1 the idea would be to change $angle in the following snippet:

if (defined $text) { $self->{gdta_x_axis}->set_text($text); my $angle = 0; if ($self->{x_labels_vertical}) { $self->{gdta_x_axis}->set_align('bottom', 'center'); $angle = PI/2; } else { $self->{gdta_x_axis}->set_align('center', 'right'); } $self->{gdta_x_axis}->draw($x - $self->{axis_space}, $y, $ +angle); }

(untested)

Replies are listed 'Best First'.
Re^2: Two questions for GD::Graph
by expresspotato (Beadle) on Jan 13, 2011 at 15:43 UTC
    Great! Both of these were exactly what I was looking for. Do you know how I can change the y_long_ticks colour or make the line dotted? Thank you, Kevin

      I don't think this is configurable, but - as usual - you could modify the sources.  In this case, it looks like changing the following snippet (search for "# Ticks and values for y axes" in axestype.pm)

      if ($self->{y_long_ticks}) { $self->{graph}->line( $x, $self->{bottom}, $x, $self->{top}, $self->{fgci} ) unless ($axis-1); }

      might have the desired effect...

      The ->line method is from the GD module, so check its docs for what parameters are expected. The $self->{fgci} argument (foreground color) is presumably what you'd need to manipulate. See also ->setStyle for dotted/dashed lines.