# Where there is a callback function where map visualization have completed to load the initial data?

**URL:** <https://discuss.elastic.co/t/where-there-is-a-callback-function-where-map-visualization-have-completed-to-load-the-initial-data/142579>\
**Category:** Kibana\
**Created:** [August 1, 2018, 1:38pm UTC](https://discuss.elastic.co/t/where-there-is-a-callback-function-where-map-visualization-have-completed-to-load-the-initial-data/142579 "2018-08-01T13:38:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![azulay7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azulay7/32/34316_2.png) [@azulay7](https://discuss.elastic.co/u/azulay7)\
**Post date:** [August 1, 2018, 1:38pm UTC](https://discuss.elastic.co/t/where-there-is-a-callback-function-where-map-visualization-have-completed-to-load-the-initial-data/142579/1 "2018-08-01T13:38:13Z")

</div>

Hi there,  
I'm running kibana 6.3.2.

I want to emit fitToData() on map visualization every time the data is loaded.  
Can some one point me where there is a callback function where map visualization have completed to load the initial data.  
I guess it is somewhere in kibana\_map.js

thank you all in Advance.  
Cheers, Amit 🙂

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [August 1, 2018, 9:56pm UTC](https://discuss.elastic.co/t/where-there-is-a-callback-function-where-map-visualization-have-completed-to-load-the-initial-data/142579/2 "2018-08-01T21:56:00Z")

</div>

Hi, if you are working with the source in development, you'll most likely want to be in a feature branch based off the master branch, which is an unreleased alpha version. A 6.3 branch is also in the Git repo, but that branch might not have new services in the code that you'd want to use for your feature.

There are custom events fired when visualization rendering has started and when it is complete. You could add an event listener to the elements containing maps that listen for render completion and then fire some code in the event handler.

Look for how the `renderStart` and `renderComplete` custom events can be used, which are set up in `src/ui/public/render_complete`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 29, 2018, 10:06pm UTC](https://discuss.elastic.co/t/where-there-is-a-callback-function-where-map-visualization-have-completed-to-load-the-initial-data/142579/3 "2018-08-29T22:06:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
