top of page

Disable/Deselect One or More Items in Legend By Default

In Sisense, all legends are enabled by default. Below script can be used to disable one more items in legend when load/refresh the widget (disabling legend means, item will be in gray color and data of disabled item will not displayed in widget. User can enable it by click on it.)




Steps:


  1. Create a Bar/Column/Area/Pie/Line chart and enable Legend

  2. Add below script to widget

  3. Update the variable 'disableLegend' with list of items in legend need to be disabled

  4. Save the script and refresh widget


widget.on('processresult', function(se, ev){
	
	let disableLegend = ['Midwest', 'South']
	
	$.each(ev.result.series, function(index, value){
		
		if(disableLegend.includes(value.name))
			value.visible = false

	})
})

144 views1 comment

1 Comment

Rated 0 out of 5 stars.
No ratings yet

Add a rating
fmol
Aug 21, 2023

is it possible to deselct all other items by dubble clicking on the selected item, now you have to click on all the items to deslect or update the variable 'disableLegend' .

Like
bottom of page