Refactor repeated code

Fix default legend function for line chart
Normalize Graph type charts by offering a getGraph function