giuliosmall opened a new pull request, #35033:
URL: https://github.com/apache/superset/pull/35033

   ### SUMMARY
   This PR fixes issue #34747 in the polygon map visualization where the legend 
color scale incorrectly calculates breakpoints, causing max values (like 38.7) 
to fall outside the legend bounds and display with incorrect colors.
   
   The issue was in the `getBreakPoints` function which didn't guarantee that 
min and max values were included in the generated breakpoints. When a value 
like 38.7 was rounded to create legend intervals (e.g., "31-38"), the actual 
max value would exceed the last breakpoint, causing it to be masked/transparent 
instead of showing the correct color.
   
   **Changes made:**
   - Fixed `getBreakPoints` function to ensure the first breakpoint always 
includes the minimum value
   - Ensured the last breakpoint always includes or exceeds the maximum value
   - Updated `maskPoint` logic to use the actual last breakpoint index for 
clarity
   - Added comprehensive test coverage for edge cases including decimal values
   
   ### TESTING INSTRUCTIONS
   1. Create a polygon map visualization with decimal max values (e.g., data 
ranging from 3.2 to 38.7)
   2. Set the number of buckets to 5
   3. Verify that:
      - The legend includes all data values within its ranges
      - The maximum value (38.7) displays with the correct color (darkest in 
the scale)
      - No values appear transparent/white due to being outside bounds
   
   4. Run the new unit tests:
      ```bash
      cd superset-frontend
      npm test -- plugins/legacy-preset-chart-deckgl/src/utils.test.ts
      ```
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes the polygon legend scale calculation issue 
reported where max values fall outside bounds
   - [ ] Required feature flags:
   - [x] Changes UI - Fixes visual display of polygon maps with decimal values
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to