abstract legend box code