blob: e5946b0786b1deb29c46edce804ac2afec8fed02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
# problems-filed-graph
# Plot graph of FixMyStreet problem report creation rate.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org. WWW: http://www.mysociety.org/
#
# $Id: problems-filed-graph,v 1.2 2008-04-11 11:05:36 francis Exp $
GPLOT_OUTPUT="set terminal png font 'Vera.ttf' 9 size 1200,600"
EXTENSION=".png"
#GPLOT_OUTPUT="set terminal fig color big thickness 1"
#EXTENSION=".fig"
#GPLOT_OUTPUT="set terminal svg size 800 250"
#EXTENSION=".svg"
cd `dirname $0`
cd ../../
source fixmystreet/commonlib/shlib/deployfns
read_conf fixmystreet/conf/general.yml
SOURCEO=/tmp/fms-report-rate-graph-data-nonwmc-$RANDOM$RANDOM
GPSCRIPT=/tmp/fms-report-rate-graph-script-$RANDOM$RANDOM
echo "select
date(created), count(*)
from problem
where state not in ('unconfirmed', 'hidden')
group by date(created)
order by date(created)
;" | psql --host $OPTION_FMS_DB_HOST --port $OPTION_FMS_DB_PORT -A -F " " $OPTION_FMS_DB_NAME $OPTION_FMS_DB_USER | egrep -v "date|rows" >$SOURCEO
#echo "source $SOURCEO"
cat >$GPSCRIPT <<END
unset border
$GPLOT_OUTPUT
set xdata time;
set timefmt "%Y-%m-%d";
# set xrange ["2005-01-01":"2006-01-01"];
set format x "%b %Y"
# set xlabel "WriteToThem.com in 2005"
unset xlabel
#set nokey
#set ylabel "cumulative messages"
set ylabel "problems filed / calendar day"
set xtics nomirror
set ytics nomirror
# set y2tics nomirror tc lt 3
n = 0
plot "$SOURCEO" using 1:2 with lines axes x1y2 lt 3 title "FixMyStreet problem reports"
# "< awk 'BEGIN { n = 0 } { n += \$2; print \$1, \$2, n; }' $SOURCE" using 1:3 with lines lt 2 title "cumulative messages created",
END
#echo "gpscript $GPSCRIPT"
export GDFONTPATH=/usr/share/fonts/truetype/ttf-bitstream-vera
gnuplot < $GPSCRIPT > fixmystreet/web/fms-live-line$EXTENSION 2>/dev/null
|