cancel
Showing results for 
Search instead for 
Did you mean: 

Add button to widget (to show/hide value labels, change widget type, open URL)

harikm007
12 - Data Integration
12 - Data Integration

It is possible to add button(s) to widgets for various purposes like to change visualization type, show or hide value labels in chart, open a url and much more.

Below script is to add button to show/hide value labels in widget:

harikm007_0-1658946337629.png

 

displayValue = false

widget.on('processresult', function(se, ev){	
	ev.result.chart.marginTop= 60
	ev.result.plotOptions.series.dataLabels.enabled = displayValue
	ev.result.plotOptions.line.dataLabels.enabled = displayValue
});

widget.on("domready", function(w, args){
	
	chart = w.chart[0][Object.keys(w.chart[0])[0]].hc
	chart.renderer.button(
		displayValue == true?'Hide Values':'Show Values', 
		10, 
		10)
		.on('click', function () {
			displayValue = !displayValue
			widget.refresh();
		})
	.add();
	
});

 

Refer below posts for adding buttons for some other purposes:

Change widget type : https://www.binextlevel.com/post/button-to-change-widget-type

Open a page/URL: https://www.binextlevel.com/post/add-button-to-sisense-widget

 

-Hari

 

0 REPLIES 0