Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect plot #56

Closed
mikesolem opened this issue Aug 22, 2024 · 3 comments · Fixed by #59
Closed

Incorrect plot #56

mikesolem opened this issue Aug 22, 2024 · 3 comments · Fixed by #59
Assignees
Labels
bug Something isn't working

Comments

@mikesolem
Copy link

First off, thanks for creating this. It is very useful!

This data results in a graph with a flat line with all values at 0.00.

func main() {
data := []float64{.2, .3, .2}
graph := asciigraph.Plot(data)
fmt.Println(graph)
}

@palash25
Copy link

palash25 commented Oct 2, 2024

i can confirm this, this happens because config.Height is an int, when you use a series with values less than 1 the calculated height will be 0.x something but when it gets set to an int it gets rounded off to 0, that 0 is then used for ratio calculation which in turn becomes zero and then zeroes everything out

@palash25
Copy link

palash25 commented Oct 2, 2024

@guptarohit if in case of a 0 height you override it with 1 this graph would plot correctly

@guptarohit guptarohit added the bug Something isn't working label Oct 11, 2024
@guptarohit guptarohit self-assigned this Oct 11, 2024
@guptarohit guptarohit linked a pull request Oct 11, 2024 that will close this issue
@guptarohit
Copy link
Owner

Thanks @mikesolem for reporting the issue, this should be fixed with changes done in pull request 59

And thanks to @palash25 for sharing your insights over the issue. 💯

I've released new version 0.7.3 🎉, please give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants