#!/usr/bin/perl -w
use CGI qw( :standard );
use CGI::Carp 'fatalsToBrowser';
print "Content-type: text/plain\n\n";
print p( "A OK" );
print "Content-type: image/png\n\n";
my $data = "05056670.txt";
my $plot = plotdata();
sub plotdata {
open my $graph => "| gnuplot" or die "Failed to open pipe: $!\n";
my $graph;
print $graph <<"gnu";
set terminal png color
set output
set xdata time
set timefmt "%Y%m%d"
set key left top title "Legend" box
set grid xtics ytics
set yrange [700:]
set format x "%Y"
set xlabel "Year"
set ylabel "Sodim, water, filtered, milligrams per liter"
set title "05056670 Western Stump Lake Major Ions"
plot "$data" using 2:3 title "P00930 Sodium dissolved"
gnu
close $graph or die "Failed to close pipe: $!\n";
}
####
!/usr/bin/perl -w
use CGI qw( :standard );
use CGI::Carp 'fatalsToBrowser';
my $q = new CGI;
print $q->header("text/html");
print p(" A OK ");
my $img = `gnuplot setcmds`;
print $q->header("image/png"), $img;
####
set terminal png color
set output
set xdata time
set timefmt "%Y%m%d"
set key left top title "Legend" box
set grid xtics ytics
set yrange [700:]
set format x "%Y"
set xlabel "Year"
set ylabel "Sodim, water, filtered, milligrams per liter"
set title "05056670 Western Stump Lake Major Ions"
plot "05056670.txt" using 2:3 title "P00930 Sodium dissolved"