use GD::Graph::lines; use GD::Graph::Map; @data = ( [ qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) ], [ reverse(4, 3, 5, 6, 3, 1.5, -1, -3, -4, -6, -7, -8)], [ (4, 3, 5, 6, 3, 1.5, -1, -3, -4, -6, -7, -8)], [ (2, 2, 2, 5, 5, 4.5,1.5, 2, 3, 5, 4, 3)], );
Instead of sticking with the hardcoded values above, I would like to read in the data from different files. ( data in a comma delimited format )

eg.

10,20,30,40
open IN, "<header_data.dat"; @myheader = <IN>; close IN; open IN, "<daily_data1.dat"; @mydata1 = <IN>; close IN; open IN, "<daily_data2.dat"; @mydata2 = <IN>; close IN; open IN, "<daily_data3.dat"; @mydata3 = <IN>; close IN;
Once the data is in the arrays, I should be able to just push the exisiting arrays
onto @data inorder to plot it. I do not understand what kind of data is used by
@data ( array of refs or array of scalar values ).

How do I store the incomming data inorder to plot it ?

$my_graph = new GD::Graph::lines(); $my_graph->set( x_label => 'Month', y_label => 'Measure of success', title => 'A Multiple Line Graph', y_max_value => 8, y_min_value => -8, y_tick_number => 16, y_label_skip => 2, box_axis => 0, line_width => 3, zero_axis_only => 1, x_label_position => 1, y_label_position => 1, x_label_skip => 3, x_tick_offset => 2, ); $my_graph->set_legend("Us", "Them", "Others"); open PNG, ">sample52.png"; binmode PNG; #only for Windows like platforms print PNG ($my_graph->plot(\@data))->png; close PNG; $map = new GD::Graph::Map($my_graph, info => '%l'); $HTML = $map->imagemap("sample52.png", \@data); __END__

In reply to Graphing basics.. by Anonymous Monk

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.