Switch graph generation programs to Perl.

This means they access the database the same way all the other scripts
do, preventing any issues due to different setups. Also tidy up state
grouping in graph, add Norway start date.