added lots of documentation particularly re: positioning SVG (sub-)elements; factored out magic numbers to do with legend