Looking at your code, it seems that the two data structures would be completely different.
The example data in @data2 consists of two array references: one for labels and one for values. Essentially, it's a 2D matrix. Your @data array would just directly contain values not wrapped within an array reference, and with no labels. I haven't played with GD::Graph or read its documentation, so that format may be acceptable. To get the two arrays identical in structure though, you could add this after the "for" loop: @data = (\@status, \@data); On 10/09/2014 7:01 am, "Bryon Baker" <bba...@copesan.com> wrote: > 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 > > bba...@copesan.com <cstep...@copesan.com> > > www.copesan.com > > *"Servicing North America with Local Care"* > > > > -- > RT Training - Boston, September 9-10 > http://bestpractical.com/training >
-- RT Training - Boston, September 9-10 http://bestpractical.com/training