This is a bit trickier, but the result is awesome:
|-------------------------------------------------------|
| Progress |
| [%, |
| numeric percent |
| cell content |
| (Number from 0 to 100)] |
|-------------------------------------------------------|
| <numeric percent cell content (Number from 0 to 100)> |
|-------------------------------------------------------|
#+TBLFM: @1$1='(<calculation with numeric percent output, changing, could be 1 today, 17 tomorrow>)
For the sake of illustration, let's say right now calc outputs numeric percent 86:
|-------------------------|
| Progress |
| [%, numeric percent |
| cell content |
| (Number from 0 to 100)] |
|-------------------------|
| 86 |
|-------------------------|
#+TBLFM: @1$1='(86)
The question now is: How to turn numeric percent cell content |86%| into progress bar ▊▊▊▊------ purely with TBLFM & elisp code?
I would go for replace-regexp-in-string
|-------------------------+------------------------------------------------------------------------------------------------------|
| Progress | |
|-------------------------+------------------------------------------------------------------------------------------------------|
| [%, numeric percent | [%, graphical percent cell content, progress bar] |
| cell content | |
| (Number from 0 to 100)] | |
|-------------------------+------------------------------------------------------------------------------------------------------|
| 86 | ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊-------------- |
|-------------------------+------------------------------------------------------------------------------------------------------|
#+TBLFM: @1$1='(86)::@1$2='(replace-regexp-in-string "<???>" "<???>" (number-to-string @1$1))
This here, ▊, is Left three quarters block, unicode U+258A
If replace-regexp-in-string finds numeric percent cell content 86, it should place 86 times ▊. But, of course, 86 could be any number between 0 - 100. So, it's rather n.
This here, -, is the common dash
Additionally, if replace-regexp-in-string finds numeric percent cell content 86, it should append 14 times - to the 86 times ▊. But of course, it's rather 100 - n, than 14. It's not fixed, not always 14.
And the question now is: How to make such a flexible replacement, additionally consisting not just of 1 new element, ▊, but 2, ▊ and -?
If this is solved, we have it!
Main question: So, the #TBLFM 1-liner, which does the trick, how does it look like?
Follow-up question once main question is solved:
How does everything look like with the length of the progress bar being flexible, connected to the org table cell width, whatever it is?
Example
|-------------------------+------------------------------------------------------------------------------------------------------|
| Progress | |
|-------------------------+------------------------------------------------------------------------------------------------------|
| [%, numeric percent | [%, graphical percent cell content, progress bar] |
| cell content | <100> |
| (Number from 0 to 100)] | |
|-------------------------+------------------------------------------------------------------------------------------------------|
| 86 | ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊-------------- |
|-------------------------+------------------------------------------------------------------------------------------------------|
#+TBLFM: @1$1='(86)::@1$2='(replace-regexp-in-string "<???>" "<???>" (number-to-string @1$1))
|-------------------------+------------|
| Progress | |
|-------------------------+------------|
| [%, numeric percent | [%, graphical percent cell content, progress bar] |
| cell content | <10> |
| (Number from 0 to 100)] | |
|-------------------------+------------|
| 86 | ▊▊▊▊▊▊▊▊▊- |
|-------------------------+------------|
#+TBLFM: @1$1='(86)::@1$2='(replace-regexp-in-string "<???>" "<???>" (number-to-string @1$1))
One certainly has to work with, integrate <50> into the conversion somehow… and do rough rounding if necessary, like for example in case of 86 to 90…
Update: If first consideration exceeds the possibilities of replace-regexp-in-string, if replace-regexp-in-string is not flexible enough for it, how can conversation of 'number n' into 'n times ▊ + 100-n times -' be acchieved more in general? Number n stored in cache, keyboard macros, emacs shell command, maybe the echo command, concat command, elisp, or a combination of some of those: There gotta has to be a way to turn a number between 0 and 100 into a visual representation in form of a progress bar.
▊
amd 14-
impossible to count. What's wrong with 86? Short and to the point and easy to interpret and understand. Graphical representations are undoubtedly useful (I would recommend Edward Tufte's books starting with "Visual Display of Quantitative Information" - but all of them are very good), but in this case all you get is visual clutter.