top of page

For any support or more customized script, contact us -  binextlevel@gmail.com

Dynamic widget title and axis label

There can be situations where we need to display widget title and axis labels based on selected item in filter. Here is a script to achieve it

Here, selected region in filter is displayed in widget title and in X-axis label


Steps:

  1. Create a widget

  2. Add below script to widget. Update the variable 'filterName' with name of filter

  3. Save the script and refresh widget


widget.on('processresult', function(se, ev){
	
	filterName = 'Region' //Name of filter
	
	selectedFilter = widget.dashboard.filters.$$items.find(el=>el.jaql.title == filterName).jaql.filter.members[0]
	ev.result.xAxis.title.text =  selectedFilter + ' Values'
	ev.widget.title = 'Total values by year: ' + selectedFilter 

})

99 views0 comments

Recent Posts

See All
bottom of page