Added support for generating graphics from the command-line using PhantomJS.

Also, fixed two bugs:
  * better positioning for arrow markers
  * monkey-patched HTMLCollection prototype to make it more portable across browsers