[rt-users] Help with building Graphs

Bryon Baker bbaker at copesan.com
Tue Sep 9 16:29:08 EDT 2014


Hello all I am trying to create some custom graphs.  The issue I am have is getting the data in the right format for GD:Graph

Using data dumper I can see that I am getting the correct data.  Per GD::Graph when I pass the data object to GD::Graph it is in an invalid format.

In the code I use the object @data for the data from Request tracker.  The data2 object I built for testing and it works fine.

Thanks in advance for the help.

Here is my test code snippet.


my @data;
my @status = qw[new assigned opened evaluation closed];
for my $status (@status)
{
    my $search = new RT::Tickets($RT::SystemUser);
    $search->FromSQL("Queue = 'cerby' AND Status = '$status'");
    push @data, $search->Count;
    #print Dumper(\@data);
    print Dumper(\$search);
}
my @data2 = (
    ["1st","2nd","3rd","4th"],
   [ 1, 3.5, 5, 6 ],
);

print Dumper(\@data2);
my $pie = GD::Graph::pie->new(400, 400);
$pie->set(
#   accentclr   => undef,
    '3d'            => 0,
) or die $pie->error;
my $img1 = $pie->plot(\@data2) or die $pie->error;
open(IMG, '>pie.png') or die $!;
binmode IMG;
print IMG $img1->png;

Thanks

Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  *  262-783-6261 ext. 2296
bbaker at copesan.com<mailto:cstephan at copesan.com>
www.copesan.com<http://www.copesan.com/>
"Servicing North America with Local Care"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140909/aeb9ca5e/attachment.htm>


More information about the rt-users mailing list