Hi,
I want to update the cluster radius using a slider in esri api 4.15. Any references
Thanks Rene Rubalcava Seems a nice one, will check on this. By the way, dorefresh() on featureReduction is not working(the method which i tried - assigned the new clusterRadius value to the layer and initiated doRefresh()).
You can use the provided Slider widget with the API, clone the FeatureReductionCluster, and update the clusterRadius.
slider<SPAN class="punctuation token">.</SPAN><SPAN class="token function">on</SPAN><SPAN class="punctuation token">(</SPAN> <SPAN class="string token">"thumb-drag"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN> value<SPAN class="punctuation token">,</SPAN> state <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>state <SPAN class="operator token">!==</SPAN> <SPAN class="string token">"stop"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">const</SPAN> fr <SPAN class="operator token">=</SPAN> layer<SPAN class="punctuation token">.</SPAN>featureReduction<SPAN class="punctuation token">.</SPAN><SPAN class="token function">clone</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> fr<SPAN class="punctuation token">.</SPAN>clusterRadius <SPAN class="operator token">=</SPAN> value<SPAN class="punctuation token">;</SPAN> layer<SPAN class="punctuation token">.</SPAN>featureReduction <SPAN class="operator token">=</SPAN> fr<SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
https://codepen.io/odoe/pen/JjXoaNX?editors=1000
If you try to do it on each tick change, even if you debounce the function, you get some artifacts along the tiles of the cluster calculations. Better to wait for the slider to stop and then update.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.