cancel
Showing results for 
Search instead for 
Did you mean: 

Customized Hover for Area Map

rahuldhomane
9 - Travel Pro
9 - Travel Pro

Hi,

When hovered over a region/state in an Area map, can we add extra lines of details [column values] in the tooltip that pops-up after hovering?

Also, it would really be helpful if we can achieve it for other chart type as well.

Thanks!

4 REPLIES 4

harikm007
12 - Data Integration
12 - Data Integration

@rahuldhomane ,

Please try below script :

widget.on("beforequery", function (se, ev) {
	
	var newJaql = {
		jaql  : {
				//agg:'max', //enable this if you need to display aggreated value
				column: "Region", //Column name
				datatype: "text",
				dim: "[Records.Region]", //table + column name
				table: "Records", //table name
				title: "Region"
		}
	}
	ev.query.metadata.push(newJaql)
	lastIndex = ev.query.metadata.length - 1	

})

widget.on("beforedatapointtooltip", function (se, args){
	
	$.each(args.widget.queryResult.$$rows, function(index, value){
		value[1].text = value[1].text + ', Region: ' + value[2].text //replace 'Region' with label you want
	
	})
})

harikm007_0-1647367703717.png

-Hari

 

 

jamnikej
7 - Data Storage
7 - Data Storage

I've noticed that when the filters change, the extra information vanishes. My script is:

widget.on("beforequery", function (se, ev) {
	
	var newJaql = {
		jaql  : {
				agg:'count', //enable this if you need to display aggreated value
				column: "ID", //Column name
				datatype: "numeric",
				dim: "[Table.ID]", //table + column name
				table: "Table", //table name
				title: "Volume"
		}
	}
	ev.query.metadata.push(newJaql)
	lastIndex = ev.query.metadata.length - 1	

})

widget.on("beforedatapointtooltip", function (se, args){
	
	$.each(args.widget.queryResult.$$rows, function(index, value){
		value[1].text = value[1].text + ', Loads: ' + value[2].text //replace 'Region' with label you want
	
	})
})

Any thoughts on how to keep the tooltip after filtering?

harikm007
12 - Data Integration
12 - Data Integration

@jamnikej ,

Minor change has been made on the script. Here is the updated script:

 

widget.on("beforequery", function (se, ev) {
	
	var newJaql = {
		jaql  : {
				//agg:'max', //enable this if you need to display aggreated value
				column: "Region", //Colum name
				datatype: "text",
				dim: "[Records.Region]", //table + column name
				table: "Records", //table name
				title: "Region"
		}
	}
	ev.query.metadata.push(newJaql)
	lastIndex = ev.query.metadata.length - 1	

})

widget.on("render", function (se, args){
	$.each(args.widget.queryResult.$$rows, function(index, value){
		value[1].text = value[1].text + ', Region: ' + value[2].text //replace 'Region' with label you want
	
	})
})

 

-Hari

 

Thanks! That fixed it.

Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!