s-tui icon indicating copy to clipboard operation
s-tui copied to clipboard

Use Unicode Block Graphics U+2581-U+2588 for bar graphs

Open rbanffy opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. The vertical resolution of the bar graphs is a character cell. It'd be 8x higher if using the block graphics between U+2581 and U+2588. Alternatively, horizontal and vertical resolutions can be doubled with 2x2 mosaics from U+2599 to U+259F. Optionally, depending on termina/font support, we could triple vertical resolution with the 2x3 mosaics introduced in Unicode 13

Describe the solution you'd like Graphs would have a higher resolution

rbanffy avatar Aug 09 '21 10:08 rbanffy

Sounds super useful. Could you be so kind to make a Pull Request for this?

amanusk avatar Aug 09 '21 15:08 amanusk

As soon as I figure out how the bars are drawn. Is this in this codebase or is it something that comes from urwid?

On Mon, Aug 9, 2021 at 4:12 PM Alex Manuskin @.***> wrote:

Sounds super useful. Could you be so kind to make a Pull Request for this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amanusk/s-tui/issues/176#issuecomment-895307824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABNDCUISQM64DO7HBBUCU3T37V5ZANCNFSM5BZWBDCA .

-- Ricardo Bánffy http://about.me/rbanffy

rbanffy avatar Aug 09 '21 18:08 rbanffy

Most of the parameters of urwid can be overridden, we do some of it in sturwid. I guess this can be as well. @giltsuker is the expert on this honestly

amanusk avatar Aug 12 '21 17:08 amanusk

From what I can tell and remember a bit, In bar_graph_vector.py, after we call the constructor of the native BarGraph class, I think you can override the native characters of the urwid base class. override:

  • self.eighths with the array for the top of the columns
  • self.char with the "base" char for the rest of the column

Note that they should be an array I think for the 2 types of colors we use. Probably some trial and error will be needed :)

giltsuker avatar Aug 12 '21 19:08 giltsuker

Funny. You are not overriding the eights, but I saw the graph with full cells only... The eights should show. image

rbanffy avatar Aug 12 '21 22:08 rbanffy