I want graphics, such as draw, to show in the printed map but not in the legend. The JS 3.x API would do this but 4.x makes a legend item which says “polygonLayer” and the graphic called “Override 1”. This makes the printed map look silly. (see attached image)
I followed advice found here and intercepted the Print request and removed my graphics layers from the operationalLayers in the Web_Map_as_JSON. However, this also removes the graphics from the map.
So in 4.x, is there a way to keep graphics in the map but remove them from the legend?
A GraphicsLayer does not have that property. So you should switch from using a GraphicsLayer and use a FeatureLayer instead. A FeatureLayer has a source property that is an collection of graphics.
When you say legend you mean the print output legend? If so I am sorry we have been miscommunicating. The legendEnabled is for the legend widget in the map.