addLegend function

Function for adding a legend to an existing device