mkaz / termgraph

a python command-line tool which draws basic graphs in the terminal
MIT License
3.14k stars 165 forks source link

TICK in Windows 10 (power shell) looks like small question marks ? #85

Open aelfakih opened 3 years ago

aelfakih commented 3 years ago

I am using Chart to show a bar graph and the individual "TICK" marks show up as question mark. Been trying to debug it and I was able to make it work when I change TICK from the defined quoted value to

TICK = u"\u2588"

At that point I get a solid color block in whatever color defined. I tried to

from termgraph import termgraph as tg
from collections import defaultdict
C = tg.AVAILABLE_COLORS

 TICK = u"\u2588"

    tg.chart (
        colors=[C["green"] , C["yellow"]] ,
        data=[[nft , og]] ,
        args=defaultdict (bool ,
            {
                "stacked" : True ,
                "custom_tick": TICK,
                "width" : 60 ,
                "format" : "{:<5.2f}" ,
                "no_labels" : True ,
                "suffix" : f" (NFT:{nft} ({nft_pct:.0f}%), OG:{og} ({og_pct:.0f}%))"
            } ,
        ) ,
        labels=[""] ,
    )

and the class would not reflect the overwrite of the TICK variable passed. I reviewed the code of the library and the TICK is a global value that is changed when is passed via the argument, but not when I import the package.

What do you recommend is the best approach to fix the definition of TICK so that it will show properly in windows 10.

-- Adonis

mkaz commented 3 years ago

Is the terminal being used support UTF-8?

The \u2588 is a standard unicode character for the full block. https://www.fileformat.info/info/unicode/char/2588/index.htm