kroitor / asciichart

Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
MIT License
1.84k stars 94 forks source link

Fix position of initial point on y-axis #37

Closed pkazmier closed 4 years ago

pkazmier commented 4 years ago

In the Python version of asciichart, the position of the first tick mark is sometimes drawn incorrectly due to a rounding error. The value should be round up, but the int function is used instead.

Before the change (the tick mark on the y-axis is at 4.5, but it should be at 6.25):

> python3 ./pplot --height 3 6 1 8
>     8.00  ┼
>     6.25  ┤╮╭
>     4.50  ┼││
>     2.75  ┤││
>     1.00  ┤╰╯

After the change:

> python3 ./pplot --height 3 6 1 8
>     8.00  ┼
>     6.25  ┼╮╭
>     4.50  ┤││
>     2.75  ┤││
>     1.00  ┤╰╯

Note: this bug is not in the node version.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 42951af60aacec52ca630250bd0bf054709f0fb2 on pkazmier:fix-position into f3d8b0708c21164c7b7785d96d0774e3f4ea0f9a on kroitor:master.