I want to add my graphics layer to the legend widget, so I created a feature layer (using the graphics layer as the source) and added it to the map. However, when I change the graphics layer based on a user's filter selection, the symbols don't change. So, I want to add the feature layer to my MapImageLayer for points I have in a map service.
Where can I find the reference for source: and datasource: within the sublayer definition?
I believe what I need to do is something like in esri's sample called layers-dynamicdatalayer-query-table. However, I want to reference my feature layer that I create on the fly each time the graphics layer changes.
I found a hack.
1. To display the points when the user filters change (returning x,y values from a SQL Server search), I create a graphics layer and add to the map. The Legend widget cannot use graphics layers.
2. To display the legend with my point symbols, I create a FeatureLayer with a renderer and use the graphics layer as the source, but I use a definition expression to exclude the point features from being shown on the map. The reason I cannot use the FeatureLayer in the map is because the values (point features) won't change after the first time the source is defined.