Classed path elements to their legend color index.