I learned a new Viz thing this week. Actually I learned two, but let’s save one for another time. What did I learn that has me so excited? I learned how to use text strings to make a 100% bar chart.
Ooooookkkkk. I hear you say. Isn’t the 100% a pretty easy chart to make, I mean, even in the spreadsheet programs? Yes, this is true – but they are huge, if you are pixel constrained. And fiddly if you need a few charts in some non standard ways. With 10 character, two colours you and a few calculated fields you can make a small 100% bar chart, that you can place around your viz. Add in a second line for the actual % number and you have a mini, spark line like 100% view.
Where can you use this. Well, let’s say you are positioning data on top of an image or map. You have limited space, and you really really really don’t want to just make 10 separate charts and manually size and position them as floating dashboards on top of an image. Use some text as the XY. How about in a long tabular style? Use some text. But it’s not just a drag and drop. I’ll be honest, the trick was hidden a bit – took two hours to find it. But there, in the text setup, was the answer.
So how do I think this works? Well, human eyes are good with length, but at 10 characters size, I reckon they don’t need to work if the bar is exactly 84% or 80%. So we can adjust a bit. Start with the % you want to share. Convert this to a 1-10 integer value, so it’s a value between 1 and 10. You might have to multiply up if your % is a decimal number, divide by 100 if it’s in 3 digits.
Then, we use some text that looks like ██████████ – which is 10 characters long. For the first part, the % to show, we use the integer value of the % to get the X left most characters. Then, we need another snip of text that is the remaining part of the 10, so take the right set of characters left – 10-% of what you have. Then in the text definition add the two text dimensions together, side by side, and set them to two text colours.
Let’s try with 84%. First , convert to integer so 84% –> 8. Then, we need 8 of the solid bars, or ████████. Then we have 2 left to bring it up to the, or ███. Let’s be positive that the first one is green, and leave the rest black. Put those side by side (not so easy in WordPress) and ██████████. Viola, a small 100% chart using text character.
Shout out to Tableau Pubic author Nhung Le, https://public.tableau.com/app/profile/le.nhung/vizzes for her very cool vis on Project Management . Follow her on Tableau Public if you like her work, or want to learn some more.