<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Graphics layer on load in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162474#M76956</link>
    <description>&lt;P&gt;yes i am doing this, but strange thing is i get the event before even graphics are shown on map. As soon as i am out of this event the graphics appear on map.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 11:42:40 GMT</pubDate>
    <dc:creator>OneBrothers</dc:creator>
    <dc:date>2022-04-08T11:42:40Z</dc:date>
    <item>
      <title>Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162296#M76953</link>
      <description>&lt;P&gt;I am working on developing a webapp using ESRI JS API 4.x. My main requirement is to search some address, zoom on the address, create a buffer, using that that buffer query data from a feature layer and show all intersecting features as graphics on map. I am able to achieve all this successfully. Next requirement is to take a screenshot of map in two different basemaps after the intersecting features are loaded on map. Previously we used to have a graphics layer on load type function which triggers when all the graphics are added on map. In API version 4.x i understand now mostly these type of events are handled using watch utils and observing value of specific variables such as graphics layer loaded.&lt;/P&gt;&lt;P&gt;My issue is, these events trigger first and then graphics are added on map which is killing the entire purpose. Till now i have used following, in all of these my graphics layer status is always loaded even though the graphics which i added are not showing on the map.&lt;/P&gt;&lt;P&gt;My only requirement is to know when graphics are visible on map.&lt;/P&gt;&lt;PRE&gt;watchUtils.&lt;SPAN class=""&gt;whenFalse&lt;/SPAN&gt;(view, &lt;SPAN class=""&gt;"updating"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;async&lt;/SPAN&gt; () =&amp;gt; {
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Watch: view Updating =&amp;gt; Graphics Layer Load Stauts : '&lt;/SPAN&gt; + graphicsLayer.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Watch: view Updating =&amp;gt; toggle.activeBasemap.loadStatus '&lt;/SPAN&gt; + toggle.&lt;SPAN class=""&gt;activeBasemap&lt;/SPAN&gt;.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'map.basemap'&lt;/SPAN&gt; + map.&lt;SPAN class=""&gt;basemap&lt;/SPAN&gt;)
});&lt;/PRE&gt;&lt;P&gt;View =&amp;gt; Updating&lt;/P&gt;&lt;PRE&gt;view.&lt;SPAN class=""&gt;watch&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'updating'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;evt&lt;/SPAN&gt;) {
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; (evt === &lt;SPAN class=""&gt;true&lt;/SPAN&gt;) {
        domClass.&lt;SPAN class=""&gt;add&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'loadingDiv'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'visible'&lt;/SPAN&gt;);
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'======graphicsLayer.loadStatus'&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(graphicsLayer.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---View Watch Updating Started'&lt;/SPAN&gt;);
    } &lt;SPAN class=""&gt;else&lt;/SPAN&gt; {
        domClass.&lt;SPAN class=""&gt;remove&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'loadingDiv'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'visible'&lt;/SPAN&gt;);
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'======graphicsLayer.loadStatus'&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(graphicsLayer.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---View Watch Updating Finish'&lt;/SPAN&gt;);
    }
});&lt;/PRE&gt;&lt;P&gt;layer view =&amp;gt; watch&lt;/P&gt;&lt;PRE&gt;view.&lt;SPAN class=""&gt;whenLayerView&lt;/SPAN&gt;(graphicsLayer).&lt;SPAN class=""&gt;then&lt;/SPAN&gt;(&lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;layerView&lt;/SPAN&gt;) {
    layerView.&lt;SPAN class=""&gt;watch&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"updating"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;value&lt;/SPAN&gt;) {
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Graphics Layer View Updating'&lt;/SPAN&gt;);
        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; (!value) {
            &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Graphics Layer View Updating ! value'&lt;/SPAN&gt;);

        }
    });
});&lt;/PRE&gt;&lt;P&gt;layerview-create&lt;/P&gt;&lt;PRE&gt;graphicsLayer.&lt;SPAN class=""&gt;on&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"layerview-create"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;event&lt;/SPAN&gt;) {
    &lt;SPAN class=""&gt;// The LayerView for the layer that emitted this event&lt;/SPAN&gt;
    graphicsLayerView = event.&lt;SPAN class=""&gt;layerView&lt;/SPAN&gt;;
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Graphics layer Layer View Create'&lt;/SPAN&gt;);
    watchUtils.&lt;SPAN class=""&gt;whenFalse&lt;/SPAN&gt;(graphicsLayerView, &lt;SPAN class=""&gt;"updating"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;async&lt;/SPAN&gt; () =&amp;gt; {
        &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Watch: view graphicsLayerView Updating '&lt;/SPAN&gt; + graphicsLayer.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
    });
});&lt;/PRE&gt;&lt;P&gt;graphics layer =&amp;gt; loaded&lt;/P&gt;&lt;PRE&gt;graphicsLayer.&lt;SPAN class=""&gt;watch&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"loaded"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;() =&amp;gt;&lt;/SPAN&gt; {
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Graphics layer loaded'&lt;/SPAN&gt;);
})&lt;/PRE&gt;&lt;P&gt;graphics layer =&amp;gt; load Status&lt;/P&gt;&lt;PRE&gt;watchUtils.&lt;SPAN class=""&gt;watch&lt;/SPAN&gt;(graphicsLayer, &lt;SPAN class=""&gt;"loadStatus"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;() =&amp;gt;&lt;/SPAN&gt; {    
    &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'---Watch: graphicsLayer Load Status : '&lt;/SPAN&gt; + graphicsLayer.&lt;SPAN class=""&gt;loadStatus&lt;/SPAN&gt;)
});&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:04:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162296#M76953</guid>
      <dc:creator>OneBrothers</dc:creator>
      <dc:date>2022-04-07T20:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162313#M76954</link>
      <description>&lt;P&gt;The graphics layer doesn't change its load status based on graphics added. Loaded just means the layer was created, since it doesn't need to load anything. Watching for the view updating property should let you know when new features are drawn on the map.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:40:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162313#M76954</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-04-07T20:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162474#M76956</link>
      <description>&lt;P&gt;yes i am doing this, but strange thing is i get the event before even graphics are shown on map. As soon as i am out of this event the graphics appear on map.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162474#M76956</guid>
      <dc:creator>OneBrothers</dc:creator>
      <dc:date>2022-04-08T11:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162571#M76960</link>
      <description>&lt;P&gt;How exactly are you measuring? Is this based on a screenshot? I tried this and I can't tell 100%, but it looks like it's fired after display. I used alert here because alert is blocking, and I can see the points when the alert is up&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/JjMvOdV?editors=1000" target="_blank"&gt;https://codepen.io/odoe/pen/JjMvOdV?editors=1000&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 15:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162571#M76960</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-04-08T15:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162963#M76970</link>
      <description>&lt;P&gt;Didi you try to watch your graphics "layer" property ..&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;myGraphic&lt;/SPAN&gt;&lt;SPAN&gt;.watch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'layer'&lt;/SPAN&gt;&lt;SPAN&gt;, (&lt;/SPAN&gt;&lt;SPAN&gt;layer&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (layer){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;//graphic is shown ...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;})&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Using watchUtils.whenDefinedOnce can also help with this...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 11 Apr 2022 10:34:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1162963#M76970</guid>
      <dc:creator>ChristopheSuter</dc:creator>
      <dc:date>2022-04-11T10:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Graphics layer on load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1164903#M77025</link>
      <description>&lt;P&gt;I tried the solution which you shared with console.log msg and it appears to be appearing either exactly at the same time or after it shows, but yes you are right i am measuring it on the basis of screenshot as i am take a screenshot as soon as graphics are loaded. I tried that and the first screenshot appeared with no graphics and the second one which i called after 3 sec wait appeared with graphics.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 22:05:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphics-layer-on-load/m-p/1164903#M77025</guid>
      <dc:creator>OneBrothers</dc:creator>
      <dc:date>2022-04-15T22:05:26Z</dc:date>
    </item>
  </channel>
</rss>

