added option of adding legend container and gave it setter and getter