3 dir=/home/dpavlin/zc/gnuplot/
7 echo "Content-type: image/svg+xml"
10 #pn=$( basename $0 | sed 's/.cgi//' )
11 test -z "$QUERY_STRING" && QUERY_STRING='.'
12 numbers=$( grep "$QUERY_STRING" $dir/../subvision-numbers.txt | head -1 )
13 pn=$( echo $numbers | cut -d' ' -f2 )
14 temp_corr=$( echo $numbers | cut -d' ' -f5 )
15 test -z "$temp_corr" && temp_corr=0.00001
17 offset=$( grep "^$pn" $dir/offset.txt )
18 offset_x=$( echo $offset | cut -d' ' -f2 )
19 test -z "$offset_x" && offset_x=0
20 offset_y=$( echo $offset | cut -d' ' -f3 )
21 test -z "$offset_y" && offset_y=0
24 set > /dev/shm/$pn.env
26 cat $dir/by_day.sql | sed \
27 -e "s/2008050087/$pn/" \
28 -e "s/x_axis_angle/x_axis_angle + $offset_x/" -e "s/y_axis_angle/y_axis_angle + $offset_y/" \
29 -e "s/0.0001/$temp_corr/" \
30 | tee /dev/shm/$pn.sql \
31 | psql --username=dpavlin -A -F "," -t zc > /dev/shm/$pn.txt-by-day
33 cat $dir/template.gnuplot | sed \
34 -e "s,axes.txt,/dev/shm/$pn.txt-by-day," \
35 -e "s,^set terminal.*$,set terminal svg," \
36 -e "s,^set output.*$,set output," \
37 > /dev/shm/$pn.gnuplot
39 gnuplot /dev/shm/$pn.gnuplot
41 #rm /dev/shm/axes.txt.$$ /dev/shm/axes.gnuplot.$$