How to make a mirrored histogram in AppSheet

Here’s a mirrored histogram that an app of mine displays:

2X_4_4af8a2c9bf837d6d5422b643ffc3a33db218b301.png

As they say on Sesame Street, the bars of the histogram are brought to you by the letter “l” (lower case “L”). I’ve experimented with various exotic characters for my histogram but I ultimately returned to @Lynn’s recommendation to use the humble “l” because it seems to work the best:

An advantage of the letter “l” in thie mirrored histogram is that, if I select “Roboto Condensed” as my app font, the “l” and a single space have the same width.

Although this mirrored histogram is displayed in my app, I put it together on its Google spreadsheet. There, I set the width of the histogram in terms of the number of characters to include in a line and then, calculate the numbers of bars (ls) and spaces to use using a formula like the following:

=roundup( ( value to represent with bars / max value in data set ) * desired width of completed histogram)

The number of spaces is determined by subtracting the number of bars from the width (in characters) I have set for my histogram.

Then I used a concatenate formula with rept ( character to repeat , number of time to repeat it) formulas to build each line. Finally, I used the following to put the lines together with carriage returns:

=ARRAY_CONSTRAIN(ARRAYFORMULA(concatenate(first cell : last cell & char(10))), 1, 1)

I had one problem initially, however.

2X_a_a0ce045f7eea80a538cd7077ae1447873c423275.png

My mirrored histogram looked like this because AppSheet ignores spaces that come before characters. Here’s the solution:

CHAR(HEX2DEC(“200B”))

This unicode character is called ‘ZERO WIDTH SPACE’ and AppSheet treats it like a normal character. So, putting this character at the beginning of each line solved my problem. (Actually, putting the character at the beginning of the first line might be enough.)

AppSheet has some cool graphic capabilities but, depending on what you are looking for, a text-based solution like this one may be your best bet.

8 2 859
  • UX
2 REPLIES 2

That’s pretty cool!

Awesome. Thank you for sharing this @Kirk_Masden.

Top Labels in this Space