add support for scale-dependant legend rendering (#4725)

closes #4725