Smart M.App discussions

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 83
Registered: ‎07-17-2017
Accepted Solution

event which fires after bi data and charts are rendered in the map?

Hi everybody,

I have a quite large dataset in my bi map which needs a while to be rendered.  After the geometries are rendered my charts are rendered. I need to work with the chart instances but the following code logs "undefined".

 

 

gsp.ready("v1.0", function (gsp) {
   gsp.bi.stage.findStage("mystageID", function (stage) {
       console.log(stage.widgets());
gsp.bi.stage.findWidget(
{
descriptor : 'mychartID',
stageId: 'mystageID'
},
function (chart) {
console.log(chart);
}
); }); });

 

I don't know which other event is fired when the charts are finally rendered.

Any ideas?

 

Regards

Marisa

 

 

Highlighted
Technical Evangelist
Posts: 1,406
Registered: ‎09-11-2015

Re: event which fires after bi data and charts are rendered in the map?

Hi Marisa,

 

Are you able to find the chart by the same ID later on? You could add JS functions such as setInterval() that would regurarly check if the desired chart is rendered, i.e. gsp.bi.stage.findWidget() returns an object.

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Frequent Contributor
Posts: 83
Registered: ‎07-17-2017

Re: event which fires after bi data and charts are rendered in the map?

Hi Jan,

 

yes, when I call my function configureCharts() which does all the explained stuff with a button and click it after everything was rendered it worked.

But to use the setInterval() function was a great idea! Thanks a lot! Now it works. :-)

 

My final code:

 

var interval=null;
interval=setInterval(function(){gsp.bi.stage.findStage(myStageId, function (stage) { var widgets=stage.widgets(); // console.log(widgets); if (widgets){ configureCharts(); clearInterval(interval); } }); },3000 );

Regards,

Marisa