Hey everyone, Just trying to figure out GD graph - I would like to dynamically assign data in order to create a dynamic graph. Here's the code I have so far, but it fails, it seems that I am not assigning the data correctly. Also, is there a way to seperate labels and data into different arrays like MS::Graph??
#!/usr/bin/perl use MSGraph qw/gen_graph/; use GD; use DBI; $sql = "select day, count(day) as day_total from tec_event_data where +month='Feb' group by day order by day asc"; $db = DBI->connect('dbi:Oracle:tec.world','tec','tectec') or die "Unab +le to connect: $DBI::errstr"; $sth = $db->prepare( $sql ); $sth->execute; my $graph = new GD::Graph::lines3d( 600, 400 ); $graph->set( x_label => 'Months', y_label => 'Number of Events', title => 'Monthly Events by Day' ); while (@row = $sth->fetchrow_array) { my $gd = $graph->plot( \@row); } my $format = $graph->export_format; open (IMG, ">/usr/tivoli/TSE/httpd/docs/images/test.$format") or die $ +!; binmode IMG; print IMG $gd->$format(); close IMG;
TIA,

In reply to GD Graph Question by liquidc00l

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.