added API to view legend