Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

should ceil the scale in bar_chart.py #6

Closed
mathiasx opened this Issue Dec 8, 2010 · 4 comments

Comments

Projects
None yet
2 participants

mathiasx commented Dec 8, 2010

Around line 54.
scale = int(float(max_value) / value_characters)

Should be
scale = int(math.ceil(float(max_value) / value_characters))

That way values like 1.4 become 2 instead of 1, which helps keep the tick marks from line wrapping.

Owner

jehiah commented Dec 9, 2010

Hi mathiasx. Is there an example set of data that highlights this problem?

mathiasx commented Dec 9, 2010

I have one with seven values, and counts of 46, 100, 8, 26, 7, 4, 82
And it tries to use "*" to count as 1.
Obviously the 100 is going to wrap (and does)
The 82 will wrap too, if you are using 80 col.

I'm not really sure what you are going for in terms of wrapping. You've hard coded a couple of values in there but it might be better to grab the window geometry and work backwards from there.

Owner

jehiah commented Dec 9, 2010

use math.ceil() to keep width < max. closed by d3f6f1a

Owner

jehiah commented Dec 9, 2010

@mathiasx thanks for the example data and the patch; Can you add a new issue for making the maximum scale size dynamic bassed on the tty window size? that'd be a good idea.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment