cancel
Showing results for 
Search instead for 
Did you mean: 

Display widget in tooltip

harikm007
13 - Data Warehouse
13 - Data Warehouse

By default values and labels are displayed in tooltip. Also its possible to add additional information to tooltip by using script . Sometimes it would be more helpful to display a widget as tooltip (Reference)

harikm007_1-1647955473438.png

Steps:

  1. Create base chart - the chart in which we need to add tooltip.

  2. Create a dashboard and add a widget that needs to be displayed as tooltip. Size of widget in this dashboard should be small enough to fit in to the tooltip.

  3. Add below script to base chart and update the variable 'dashboaardurl' with URL of dashboard we created for tooltip.
var category

widget.on('beforedatapointtooltip', function(se, ev){
	
	dashboardurl = 'https://XXXX.sisense.com/app/main#/dashboards/6612346ac77683002ea37645'
	
	redrawYN = category != ev.context.category
	category = ev.context.category

	filterPanel = ev.widget.metadata.panels[0].items[0].jaql
	filterPanel.filter = {
		explicit: true,
		members: [category],
		multiSelection: true
	}

	filterjaql = {jaql: filterPanel}

	var filtersArray = [filterjaql];
	var filterString = JSON.stringify(filtersArray);
	var uriEncoded = encodeURIComponent(filterString);

	ev.template = `<iframe width="100%" frameborder="0" 
		src="${dashboardurl}?embed=true&r=false&filter=${uriEncoded}"></iframe>`
	
	if(redrawYN)	
		se.redraw()
	
})

Note:

  • Supported widget - Line chart, Column chart, Bar chart, Pie chart

  • Currently this script doesn't support widget with 'breakby' panel.

  • Tooltip may take few seconds to load as it is actually a dashboard.

 

-Hari

 

3 REPLIES 3

gwolfe
9 - Travel Pro
9 - Travel Pro

This is awesome. Thank you.

Girish_123
7 - Data Storage
7 - Data Storage

Is it possible to add tooltip on indicator visual if yes will please tell us how

 

dhalsey
7 - Data Storage
7 - Data Storage

Brilliant!

Is it possible to embed an external url to the tooltip ideally showing relevant text values?