GD::Graph::Lines ... Controling some behavior...

Discussion in 'Perl' started by TeraNews, Jan 9, 2004.

  1. TeraNews

    TeraNews Guest

    I have a sample graph using GD::Graph::Lines, it's a simple X-Y line graph
    (www.bitmosphere.com/cgi-bin/graph.pl) I want to change the color of the
    graph border, and the tick lines (vertical and horiziontal). I can't seem
    to find how to change them to: border being black, horiziontal lines being
    light gray dashed, and vertical being light gray. Anyone know if this is
    possible, or has done this?


    Code:
    #!/usr/bin/perl

    use CGI::Carp qw(fatalsToBrowser);
    use CGI ':standard';
    use GD::Graph::lines;
    use strict;

    # Both the arrays should same number of entries.
    my @data = (['v1', 'v2','v3','v4','v5'],
    [30.5, 31, 31.04, 30.75, 33.01],
    [29.5, 30.25, 30.25, 30.2, 30.75 ]);

    my $mygraph = GD::Graph::lines->new(600, 300);
    $mygraph->set(
    x_label => 'X Axis',
    y_label => 'Y Axis',
    title => 'Chart Title',

    y_tick_number => 5,
    y_min_value => 29,
    y_max_value => 34,
    x_label_skip => 2,
    long_ticks => 1,

    # Draw datasets in 'solid', 'dashed' and 'dotted-dashed' lines
    line_types => [1, 1],

    # Set the thickness of line
    line_width => 1,

    # Set colors for datasets
    dclrs => ['blue', 'red'],
    ) or warn $mygraph->error;


    $mygraph->set_legend_font(GD::gdMediumBoldFont);
    $mygraph->set_legend('Line Type 1', 'Line Type 2');

    my $myimage = $mygraph->plot(\@data) or die $mygraph->error;

    print "Context-type: image/png\n\n";
    print $myimage->png;



    Thanks,
    Brian
    TeraNews, Jan 9, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Sakkis
    Replies:
    1
    Views:
    435
    Szabolcs Nagy
    Jan 29, 2007
  2. Dr Ann Huxtable

    Missing Graph.h and (Graph.lib) woes - any help

    Dr Ann Huxtable, Dec 21, 2004, in forum: C Programming
    Replies:
    6
    Views:
    628
    Dr Ann Huxtable
    Dec 21, 2004
  3. Jef Driesen
    Replies:
    3
    Views:
    2,527
    mlimber
    Jan 24, 2006
  4. Almoni
    Replies:
    0
    Views:
    3,084
    Almoni
    Jan 17, 2010
  5. Emilio Mayorga
    Replies:
    6
    Views:
    315
    Martien Verbruggen
    Oct 8, 2003
Loading...

Share This Page