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

potential divide by 0 error in getY() returns NaN #24

Open
jakedowns opened this issue Nov 26, 2022 · 0 comments · Fixed by charleseidsness/sparkline#1 · May be fixed by #25
Open

potential divide by 0 error in getY() returns NaN #24

jakedowns opened this issue Nov 26, 2022 · 0 comments · Fixed by charleseidsness/sparkline#1 · May be fixed by #25

Comments

@jakedowns
Copy link

jakedowns commented Nov 26, 2022

https://github.com/fnando/sparkline/blob/3008997512faff401da2c6a953fa600cd87de90b/src/sparkline.js#LL1-L3C2

a if(max===0) return height; might be useful at the top of this fn

glaszig added a commit to glaszig/sparkline that referenced this issue Dec 3, 2022
calling getY() with 0 value would produce NaN which are invalid in svg where those end up.
in that case, the added condition returns the height in float to draw a data point at y=0.

releated fnando#13, closes fnando#24, fixes fnando#14
@glaszig glaszig linked a pull request Dec 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant