Use invoke to call chart and legend functions
Remove need to pass $sce through multiple functions and remove it from legend function