Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Regular Contributor
Posts: 193
Registered: ‎11-17-2015
Accepted Solution

MAE Feature Analyser - Display/Hide BI widget programatically

Hello,

 

Does anyone know how to programatically display/hide a BI widget in feature Analyser?

The goal is to do the same thing than the general menu does when clicking in the BI widget visibility checkbox.

 

Thank you. 

Highlighted
Technical Evangelist
Posts: 10
Registered: ‎05-28-2019

Re: MAE Feature Analyser - Display/Hide BI widget programatically

Hello,

 

Toggling widgets/charts on/off programatically can be done either through a HTML/Number chart (javascript function) or through a functional attribute. The first step is getting the correct dataset:

 

// Get the default dataset. If your widget/chart is assigned to another dataset, pass the dataset name in as a parameter to findStageModel.

var defaultDataset = Analyzer.findStageModel(); 

 

// Next get the widget/chart - the following line shows an example of getting a widget by named parameters

// valid widget types are: composite, pie, theme, line, bar, table, row, gauge, scatter, dayOfWeekRowChart, dateLineChart, timeOfDayBarChart, heatMapByDate, number, html, fulltext, combo, text, heat, luciad, leaflet

 

var widget = defaultDataset.widgets.find((w) => { return w.title === "my chart title" && w.type === "combo"; });

 

// Or you can get the widget by index (if you don't plan on moving the display order in the additional charts tab):

var widget = defaultDataset.widgets[1];

 

// set visible flag

widget.visible = true; // or false

 

// finally, apply settings

widget.reload();

 

Hope this helps,

 

Dave

Highlighted
Regular Contributor
Posts: 193
Registered: ‎11-17-2015

Re: MAE Feature Analyser - Display/Hide BI widget programatically

Thank you Dave!