top of page

Disable/Deselect One or More Items in Legend By Default

Updated: Nov 27, 2024

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.)



ree

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

	})
})

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

BI Next Level is your trusted resource for BI customization, data solutions, and expert insights. Explore practical tips, scripts, and tutorials for tools like Sisense, Python, and SQL. Let’s transform your data into impactful insights together.

Quick Links
Connect with us
bottom of page