#!/usr/bin/perl -w
#
#
# This is the HTML form for selecting projects for QA Metrics
#
use lib qw(/tools/local/lib/perl5);
use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use GD::Graph::linespoints;
use Date::Calc qw(check_date Add_Delta_Days);
my $cgi = new CGI;
if ( !$cgi->param ) {
### The form goes here
} else {
if(no_errors) {
##### Run DBI query - get data
#####Plot perl GD graph
my $title = "Open Bugs for $project_name1";
my $mygraph = GD::Graph::linespoints->new( 600, 400 );
#my @legend_keys = qw(new_bugs open_bugs reopen_bugs fixed_bugs verified_bugs );
$mygraph->set(
x_label => 'Log_Date',
y_label => $y_label,
x_label_skip => 10,
x_labels_vertical => 'true',
title => $title,
legend_placement => 'BL',
legend_marker_height => 12,
dclrs => [qw(green blue red yellow brown orange)],
) or warn $mygraph->error;
$mygraph->set_legend(@legend_keys);
$mygraph->set_title_font(GD::gdGiantFont);
$mygraph->set_x_label_font(GD::gdLargeFont);
$mygraph->set_y_label_font(GD::gdLargeFont);
my $myimage = $mygraph->plot( \@data ) or die $mygraph->error;
# binmode STDOUT;
print $cgi->header( -type => 'image/png' );
print $myimage->png;
}