Changed scope of variable "type" to local

If two different types of charts where on the same page they shared the type variable so it was impossible to get two different types of charts in one angular scope.