Updated legend to use metadata from idata.