got the getLegend method working