Formatting Values in Tooltips


In this tip we will discuss how to update the formatting on a Visualization's tooltips. Assume  we have a Bar Chart which displays the sum of sales for each year in our data table.

What if we then want to change the y-axis to show the Percentage of Total Sales for each year. This would require changing the y-axis to a custom expression using the OVER function:

Sum([Sales]) / Sum([Sales]) OVER (All([Axis.X]))


 


The formatting will still stay as a currency type (as that is what it was when we started), so we will need to update the formatting to percentage on the y-axis:


 

That will fix the formatting on the axis and the Bar Chart labels, but will not update the tooltip:
 


To update the tooltip, we will have to add another tooltip entry with a custom expression:


Concatenate((Sum([Sales]) / Sum([Sales]) OVER (All([Axis.X]))) * 100," %")

 

In this expressoin we take the original expression, multiply it by 100 to get to a percentage and then actually output a string with is that resulting value concatendated with a % character.

In addition, we will have to update the original ‘Sales’ column data type from ‘Currency’ to ‘Number’. When this is done, you will see the tooltip (shown below), will be updated with the proper formatting.

 

 
To learn more about TIBCO Spotfire Professional features, watch our newly updated TIBCO Spotfire Professional Jumpstart. This is a free eLearning course which covers the breadth of capabilities available in TIBCO Spotfire. Follow the link below to watch and when prompted, login as a guest.

http://spottrain.tibco.com/sln/course/view.php?id=85