03-16-2018 07:39 AM
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
Solved! Go to Solution.
03-16-2018 11:07 AM
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
03-17-2018 09:46 AM
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