Hi - I'm using version 4.18 of the api and am adding a polygon graphic and a point graphic (text label)l to a map using the addMany method. After adding the graphics I pan to the center of the polygon and set the zoom level to 16. The problem is that the user needs to zoom the map manually for the label to appear. Does anyone know how I can fix this problem? I'm guessing the text label probably hasnt been added to the map yet when the zoom and center occur in my code below
Thanks
Pete
I would suggest looking at the after-add event that gets fired when the addMany function is called.
Thanks Theo. I've tried adding the code shown for this event in the docs, but the event only seems to fire when the graphicsLayer is initially added to the map
I wonder if something like this might help?
view.goTo({target: polygonGraphic.geometry.extent.center, zoom:16}).then(()=>{
graphicsLayer.addMany([polygonGraphic, ptGraphic]);
});
Thanks John, I tried it, but I still need to zoom in or out to get the graphics to display on the map
Do you have a CodePen where we can experience the issue?
Hi John - it works ok with pure Javascript. I'm using typescript and angular so I guess this is whats giving me trouble. My code is below. I've based it on the github jsapi-angular-cli example located here: https://github.com/Esri/jsapi-resources
Hi! Is there any updates about this issue?
I have exactly same problem. I'm using Angular and Typescript. Implemented some logic to select point (Graphics) on a map view. On user 'ctrl+click' on point - it should become 'selected' and change color. Everything works, but points disappearing from map or (rare) don't change color. Only when I manually or throught the code change zoom or move map by mouse - changes appearing.
I really want some way to manually update graphics on the map when I do some changes.
I'm seeing a similar issue as well. Mine happens with a Graphics Layer in a SketchViewModel instance But the trigger is modifying the graphic.symbol values. It will make polygons or points in close proximity to one another disappear or partially disappear. Geometries drawn further away from each other do not have this problem. Zooming brings back any missing symbols.
Using TypeScript and React if that helps.