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

	})
})

142 views1 comment

1 comentario

Obtuvo 0 de 5 estrellas.
Aún no hay calificaciones

Agrega una calificación
fmol
21 ago 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' .

Me gusta
bottom of page