fixed bug in adjusting viewBounds for legends (#14)
fixed bug in adjusting viewBounds for legends (#14)

* Fix bug in adjusting viewBounds for legends.
* Clean up code and add comments.

vega/vega,vega/vega,vega/vega,lgrammel/vega,vega/vega