update legend method.