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

Sparkline content isn't rendered correctly when input data is all zeros #2

Open
pridmorej opened this issue Nov 15, 2022 · 0 comments

Comments

@pridmorej
Copy link

Hello,

Firstly, thank you for providing this library, it's a really handy tool.

In SparklineFont.DrawSparkline you search the input data for min and max, however, if the data only contains zeros, max is set to zero and therefore pcy0 and pcy1 are set to NaN due to a divide by zero issue.

For example, the input data "0.0,0.0,0.0" results in the GeneratedText being as per sample below and not rendering correctly in the browser.

<span class="Sparklines"><span class="sparkline-start">&#-2147419558;</span>
 &#-2147483472;&#-2147483600;&#-2147483600;&#-2147483472;&#-2147483600;&#-2147483600;
<span class="sparkline-stop">&#-2147419558;</span></span>

I'd have a go at creating a PR, but not sure how you'd want it fixed. Any chance you could take a look please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant