Using Bar Charts in Tooltips

Andy Cotgreave
on September 30, 2010

Effectively displaying a large amount of information in a small amount of space can be incredibly difficult. Tooltips, the pop-ups that you see when you hover over an object, are an excellent way to achieve this. Until now, tool tips have been confined to text. This is normally sufficient, but in some cases a visual display of the data is much easier to understand quickly. With this new technique from Andy Cotgreave, you can get the best of both worlds and use bar charts in your tooltips. Read how below...

If you press Alt,2,1,9 on your keyboard, you get this wonderful little character █. With no kerning at all, you can place as many of them side by side as you want, to create a continuous text bar. Used in conjunction with a simple calculation, one can automatically size the bars to the proportion of a measure.

As you can see, there are 100 alt-2-1-9's in a row. The calculation LEFT insures that only the number of characters specified in the second part of the calculation (,ROUND([% coffee sales]) are displayed. In other words, if 29.22% of sales in South Dakota were for coffee, then that number would be rounded to 29, and the calculation would display only the leftmost 29 alt-2-1-9's. Repeat for as many measures as you want to display and voila! Tooltip charts.

Thanks again to Andy Cotgreave for this fascinating and analytically valuable trick.