Skip to content

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

Merged
themustafaomar merged 3 commits intothemustafaomar:mainfrom
alexboarotto:main
May 5, 2024
Merged

fixed dataVisualization from displaying black region when there is 1 value#147
themustafaomar merged 3 commits intothemustafaomar:mainfrom
alexboarotto:main

Conversation

@alexboarotto
Copy link
Copy Markdown
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
Copy Markdown
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