Update number two: I've created a similar solution that also *almost* works, but still only outputs a single line for the graph. If anyone has any idea, it'd be a lifesaver, for sure.
use DBI; use Class::Date qw(:errors date localdate gmdate now -DateParse -EnvC) +; use GD::Graph::lines; use Net::SMTP; #Change our date format since we don't care about times for these repo +rts. $Class::Date::DATE_FORMAT="%Y-%m-%d"; #Select our currently used Database $dbh = DBI->connect(); #prepare our sql statement 1 $sth1 = $dbh->prepare("SELECT GroupName, Members, NotifyTo FROM [Group +] "); $sth1->execute(); while (@row = $sth1->fetchrow_array) { $Group = @row[0]; @user = split (/\,/, @row[1]); #print "@user\n"; $userlist = ""; $userlist2 = ""; $x = 0; foreach $username (@user) { @date = ""; @totals = ""; $sth2 = $dbh->prepare("SELECT UserID, Name FROM [User] WHERE UserID = '$username'"); $sth2->execute(); while (@row1 = $sth2->fetchrow_array) { $longname = @row1[1]; $userlist .= "\[$longname\], "; $x++; } $userlist2 = substr($userlist, 0 ,-2); #print "$userlist2\n"; $sth3 = $dbh->prepare("SELECT Date, $userlist2 FROM [TicketSta +tus] WHERE Field LIKE 'Status' ORDER BY Date"); $sth3->execute(); while (@row2 = $sth3->fetchrow_array) { $date = date @row2[0]; push (@date, $date); $totals[$x] = @row2[$x]; #print "@row[0] X: $x $date: $totals[$x] \n"; push (@totals, $totals[$x]); #print "$date: @row[0] @totals\n"; } print "$group X $x $date: @totals\n\n"; } @data = ( [@date], [@totals] ); $graph1 = GD::Graph::lines->new(1024, 768); $graph1->set( x_label => 'Date', y_label => '% Closed', title => "$Group Vulnerability Tickets Closed" +, y_max_value => 100, y_tick_number => 10, x_label_skip => 7 ) or die $graph->error; $graph1->set( dclrs => [ qw(black dblue gold dgreen dred d +purple lorange dpink marine cyan dbrown lgray lblue lyellow dyellow l +green lred lpurple pink ) ] ); $graph1->set( line_types => [1, 3] ); $graph1->set_legend($userlist2); my $gd = $graph1->plot(\@data) or die $graph1->error; open (IMG, ">./$Group-test.jpg"); binmode IMG; print IMG $gd->png; close IMG; }

In reply to Re: Issues graphing multiple data sets on the same graph in GD::Graph by SoaponaRope
in thread Issues graphing multiple data sets on the same graph in GD::Graph by SoaponaRope

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.