scaleFactor calculation for gradient could cause divide by zero error…#6
Open
dustradio wants to merge 1 commit intotmroyal:masterfrom
Open
scaleFactor calculation for gradient could cause divide by zero error…#6dustradio wants to merge 1 commit intotmroyal:masterfrom
dustradio wants to merge 1 commit intotmroyal:masterfrom
Conversation
…s. Add 1 to dataLength instead of subtracting one.
|
I fixed this issue by using a conditional statement before it calculates the scaleFactor for 'gradient' colorInterpolation. Since I was not having any issue if the datalength is equal to zero, I just used the conditional statement for datalength 1 or 2. I tried to use your fix but I was not getting the exact color gradient, so here it looks like in my code: |
shoffing
approved these changes
Dec 27, 2018
shoffing
left a comment
There was a problem hiding this comment.
I had the same problem, this change resolves it. Please merge this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should fix:
#2
If the range of heatmap data isn't sufficiently large you can get divide by zero errors. Looks like maybe should be adding one here instead of subtracting.
Not sure what version of Charts.js you were basing this off off, so I didn't rebuild the whole project, just changed the main source file.