Created
November 15, 2012 21:39
-
-
Save jontonsoup/4081490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elsif ($type eq "plot") { | |
print header(-type => 'image/png', -expires => '-1h' ); | |
if (!defined($symbol)) { | |
# $symbol = 'AAPL'; # default | |
} | |
open(GNUPLOT,"| gnuplot") or die "Cannot run gnuplot"; | |
print GNUPLOT "set term png\n"; # we want it to produce a PNG | |
print GNUPLOT "set output\n"; # output the PNG to stdout | |
print GNUPLOT "plot '-' using 1:2 with linespoints\n"; # feed it data to plot | |
foreach my $r (@rows) { | |
$counter = $counter + 1; | |
if($counter % $mod != 0){ | |
next; | |
} | |
print GNUPLOT $r->[0], "\t", $r->[1], "\n"; | |
} | |
print GNUPLOT "e\n"; # end of data | |
# | |
# Here gnuplot will print the image content | |
# | |
close(GNUPLOT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment