0

I would like to show a loading icon while my Dojo Charts are loading and then hide it when the charts are finished rendering. I cannot find documentation that defines what event I can add a dojo.connect to when the chart has finished rendering. For example, I am doing something similar with the ArcGIS mapping API (built on Dojo) where I have a loading icon displayed when the map updates and then I hide it when the map is finished updating using this line of code:

dojo.connect(map, "onUpdateEnd", hideLoading);

I have tried "onUpdateEnd", "onStartup", "postCreate" with no luck. Anyone know if there is a "rendering complete" event I can use with Dojo Charts?

chadwilcomb
  • 113
  • 5
  • you would need to tell which module exactly you're using in the chart collection, since one might differ from the other (common in dojox). Widgets does not fire events 'onMethodCalled' like your pattern describes here, you expect startup() to fire onStartup. Instead, create the listener on the 'real' method name like so; `dojo.connect(onObj, "startup", mappedFuncObj)` – mschr May 19 '12 at 11:30
  • Since the issue with the charts loading was a data retrieval issue and there was no significant delay in the chart rendering, I just show the loading icon and hide it when the data comes back. The chart rendering itself is super fast so I don't need to tie an event to the rendering complete event. – chadwilcomb Aug 27 '12 at 16:06

1 Answers1

0

For any one else that requires to listen on a completion of any method of almost any dojo object, look at dojo/aspect. http://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html

Sample code:

aspect.after(this.chart, "render", function () {
    //your code here
    console.log("render completed");
});
Darrel K.
  • 1,611
  • 18
  • 28