# Your SQL here. while (my ($timestamp, $field1, $field2, $field3)=$sth->fetchrow_array() { push @timeline, $timestamp; push @data1, $field1; push @data2, $field2; push @data3, $field3; } #### my $graph = GD::Graph::mixed->new($x_size, $height); my @data=([@timeline],[@data1],[@data2],[@data3]); $graph->set( y_label => 'Your graph title', title => "$title", line_width =>2, line_types =>[1,1], skip_undef =>1, box_axis =>1, correct_width =>1, fgclr =>"black", legendclr =>"black", x_label_skip =>$x_skip ) or die $graph->error; $graph->set_text_clr('black'); $graph->set( 'y_number_format' => \&y_format ); $graph->set_title_font(GD::gdSmallFont,12); $graph->set( types => ['area', 'lines','lines'] ); $graph->set( dclrs => ['pink','blue','green'] ); $graph->set_legend('your legend1', 'your legend2', 'your legend 3'); $graph->set(y_max_value=>($y_max)); $graph->set(y_min_value=>(0.1)); } my $gd = $graph->plot(\@data) or die $graph->error; binmode STDOUT; print $gd->jpeg(100); }