cancel
Showing results for 
Search instead for 
Did you mean: 

Add additional information in tooltip - (Column, Bar, Line, Area charts - stacked and classic)

harikm007
12 - Data Integration
12 - Data Integration

Here is how you can include more information in tooltip.

harikm007_0-1646977646307.png

Steps:

  1. Create column/bar/line/area chart

  2. In this approach, result of disabled Values panel will display as additional information in tooltip . So create and disable Values panel as required. Make sure there is only one Values panel is enabled and there is no Categories and Break by panel is disabled.

  3. Add below widget script and save

  4. Refresh widget

(Reference)

 

widget.on("beforequery", function (se, ev) {
	$.each(ev.widget.metadata.panels[1].items, function(index, value){
		if(value.disabled == true)
		{
			var newJaql = {
				jaql  : JSON.parse(JSON.stringify(value.jaql))
			}
			ev.query.metadata.push(newJaql)
			lastIndex = ev.query.metadata.length - 1
			ev.query.metadata[lastIndex].disabled = false	
		}
	})
})

widget.on("beforedatapointtooltip", function (se, args){

	var valueSet, breakbyExist = false, categoryExist = false

	if(args.widget.metadata.panels[2].items.length > 0)
		breakbyExist = true

		if(args.widget.metadata.panels[0].items.length > 0)
			categoryExist = true

			category = args.context.category
			seriesName = args.context.points[0].seriesName

			if(categoryExist)
			{
				categoryTitle = args.widget.metadata.panels[0].items[0].jaql.title
				categoryIndex = args.widget.rawQueryResult.headers.indexOf(categoryTitle)
			}

	if(breakbyExist)
	{
		breakbyTitle = args.widget.metadata.panels[2].items[0].jaql.title
		breakByIndex = args.widget.rawQueryResult.headers.indexOf(breakbyTitle)
	}

	$.each(se.rawQueryResult.values, function(key, value)
		   {
		if(!categoryExist)
		{
			if(value[breakByIndex].text == seriesName)
			{
				valueSet = value
			}
		}else if(!breakbyExist)
		{
			if(value[categoryIndex].text == category)
			{
				valueSet = value
			}
		}else
		{
			if(value[breakByIndex].text == seriesName && value[categoryIndex].text == category)
			{
				valueSet = value
			}
		}
	})

	$.each(args.widget.metadata.panels[1].items, function(index, value){
		if(value.disabled == true)
		{

			resultIndex = args.widget.rawQueryResult.headers.indexOf(value.jaql.title)
			args.context.points[args.context.points.length]= {

				seriesName: value.jaql.title,
				showPercentage: false,
				value: valueSet[resultIndex].text,
				valueColor: args.context.points[0].valueColor

			}
		}
	})
})

 

-Hari

4 REPLIES 4

rahuldhomane
9 - Travel Pro
9 - Travel Pro

Can we have it for Area Map @harikm007 ?

 

harikm007
12 - Data Integration
12 - Data Integration

@rahuldhomane ,

Above script won't work for Area Map. Please try script in this post : 

https://community.sisense.com/t5/build-analytics/customized-hover-for-area-map/m-p/2586/highlight/tr...

-Hari

gwolfe
9 - Travel Pro
9 - Travel Pro

Can we have this for a funnel chart?

nikitabansal
7 - Data Storage
7 - Data Storage

this is very useful , for my requirement I have past month/past quarter comparisons which I would like to show in the tool tip

is it possible

1. to hide the value which is not applicable at the time for example I am changing the view with blox buttons to date granularity so ideally I only want to show month comparison when month is selected in the view 

2. The numbers are not showing in % how do I edit that please?

Community Toolbox

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

Need additional support?:

Community Support Request