auto update class resource id in legend on change