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

fixed dataVisualization from displaying black region when there is 1 value #147

Merged
merged 3 commits into from
May 5, 2024

Conversation

alexboarotto
Copy link
Contributor

In the visualize() method, colors for regions based on the provided values. However, when there's only one value, the color calculation is not being handled properly.

When you only have one value, the getValue() method is being called with the same value for this.min and this.max, resulting in a division by zero error. This leads to NaN making the color always black.

To address this issue we can check if the min and max value are the same and just return the _toColor as a default

@themustafaomar
Copy link
Owner

Thanks

I've applied additioanl fixes.

  • Replace rgbToHex to hexToRgb
  • Return an actual hex value instead of the array

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

Successfully merging this pull request may close these issues.

3 participants