yousoph opened a new pull request, #41864:
URL: https://github.com/apache/superset/pull/41864
> ↪️ Re-points #38522 onto my own fork so the review fixes could be pushed
directly. Original review discussion (thanks @rusackas, @msyavuz, @sadpandajoe)
lives on #38522; this PR carries all four requested fixes.
## **User description**
### SUMMARY
Fixes the heatmap tooltip so it displays actual axis values (e.g., "Monday",
"Morning") instead of numeric indices (0, 1, 2...), corrects the tooltip
percentage calculation, and adds comprehensive regression tests.
**Context:** After PR #36302 changed the heatmap data structure to use axis
indices for proper sorting, the tooltip formatter was not updated to look up
actual values from the sorted arrays. This caused tooltips to display raw
indices instead of formatted axis labels.
**What this PR does:**
- Fixes the tooltip formatter to look up actual x/y values from the sorted
axis arrays instead of rendering raw indices
- Corrects the tooltip percentage calculation by keying `calculateTotals`
off the query `colnames` (the real column names present in the data) instead of
`getColumnLabel(...)` — the old keying produced `NaN` percentages whenever the
derived label diverged from the data columns (notably array `groupby`)
- Adds 5 test cases covering different tooltip scenarios
- Ensures tooltips display actual axis values, not numeric indices
- Verifies tooltip behavior with different sort orders (alphabetical
asc/desc, value-based asc/desc)
- Tests percentage calculations use actual values when `normalizeAcross` is
enabled
- Validates tooltip handling of numeric axes
**Why these tests matter:**
These tests prevent future regressions by verifying the tooltip formatter
correctly:
1. Looks up actual x/y values from `sortedXAxisValues` and
`sortedYAxisValues` arrays
2. Uses actual values (not indices) for percentage calculations in
`totals.x[xValue]` and `totals.y[yValue]`
3. Handles different data types (strings, numbers) and sort configurations
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — the change affects tooltip text/percentage values (indices → axis
labels, `NaN%` → correct %), which are covered by the added regression tests.
### TESTING INSTRUCTIONS
1. Run the heatmap tooltip tests:
```bash
cd superset-frontend
npm test -- transformProps.test.ts
___
## **CodeAnt-AI Description**
Fix heatmap tooltip to show actual axis labels and correct percentage
calculations
### What Changed
- Tooltip displays actual x/y axis values (e.g., "Monday", "11") instead of
numeric indices
- Percentage shown in tooltip uses the real axis totals (not indices) when
normalization is enabled
- Added tests covering alphabetical and value-based sorting, numeric axes,
and percentage/normalization cases to prevent regressions
### Impact
`✅ Clearer heatmap tooltips`
`✅ Correct heatmap percentage values`
`✅ Fewer tooltip regressions`
<details>
<summary><strong>💡 Usage Guide</strong></summary>
### Checking Your Pull Request
Every time you make a pull request, our system automatically looks through
it. We check for security issues, mistakes in how you're setting up your
infrastructure, and common code problems. We do this to make sure your changes
are solid and won't cause any trouble later.
### Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can
easily get in touch with CodeAnt AI right here. Just type the following in a
comment on your pull request, and replace "Your question here" with whatever
you want to ask:
<pre>
<code>@codeant-ai ask: Your question here</code>
</pre>
This lets you have a chat with CodeAnt AI about your pull request, making it
easier to understand and improve your code.
#### Example
<pre>
<code>@codeant-ai ask: Can you suggest a safer alternative to storing this
secret?</code>
</pre>
### Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future
reviews. Reply directly to the specific CodeAnt AI suggestion (in the same
thread) and replace "Your feedback here" with your input:
<pre>
<code>@codeant-ai: Your feedback here</code>
</pre>
This helps CodeAnt AI learn and adapt to your team's coding style and
standards.
#### Example
<pre>
<code>@codeant-ai: Do not flag unused imports.</code>
</pre>
### Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
<pre>
<code>@codeant-ai: review</code>
</pre>
### Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at
[https://app.codeant.ai](https://app.codeant.ai). This tool helps you identify
potential issues and areas for improvement in your codebase, ensuring your
repository maintains high standards of code health.
</details>
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]