Skip to content

feat: extend goto feature to work with heatmaps row, column, and global extremas using fill values#569

Merged
soundaryakp1999 merged 1 commit intomainfrom
feat/heatmape_extrema
Mar 10, 2026
Merged

feat: extend goto feature to work with heatmaps row, column, and global extremas using fill values#569
soundaryakp1999 merged 1 commit intomainfrom
feat/heatmape_extrema

Conversation

@soundaryakp1999
Copy link
Collaborator

Pull Request

Description

Added identification and navigation to global, row, and column extrema points in heatmap based on fill values. Earlier, heatmap did not support the Go to feature.

Related Issues

Changes Made

◦ findGlobalExtrema() - finds global max/min across entire grid
◦ findRowExtrema() - finds max/min in a specific row
◦ findColExtrema() - finds max/min in a specific column

Screenshots (if applicable)

Checklist

  • I have read the Contributor Guidelines.
  • I have performed a self-review of my own code and ensured it follows the project's coding standards.
  • I have tested the changes locally following ManualTestingProcess.md, and all tests related to this pull request pass.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation, if applicable.
  • I have added appropriate unit tests, if applicable.

Additional Notes

@claude
Copy link

claude bot commented Mar 7, 2026

PR Review: feat/heatmape_extrema - Go to Extrema in Heatmap

Good contribution! Adding extrema navigation to heatmap fills a clear gap. The structure follows existing patterns in bar.ts and segmented.ts. Here are the findings:


BUGS

  1. Empty first row not guarded in findGlobalExtrema and findColExtrema

findGlobalExtrema checks heatmapValues.length === 0 but not whether heatmapValues[0] is empty. If heatmapValues[0] is [], then extremaValue = heatmapValues[0][0] initializes as undefined and all comparisons silently fail, returning { row: 0, col: 0, value: undefined }.

findColExtrema has the same issue: it bounds-checks colIndex against heatmapValues[0].length but never verifies heatmapValues[0] itself exists.

  1. NaN propagation produces silently incorrect extrema

If heatmapValues contains NaN (not explicitly forbidden by HeatmapData), comparisons like value > extremaValue always return false. The initial cell is silently returned as the extrema regardless of actual data. Guard against NaN — MathUtil.safeMin/safeMax shows the established pattern.


PERFORMANCE

  1. Two O(rows x cols) passes for global extrema

getExtremaTargets() calls findGlobalExtrema('max') then findGlobalExtrema('min') separately, each scanning the full grid. A single combined pass — as MathUtil.minMax() demonstrates for 1D arrays — could return both positions at once. This runs on every go-to-extrema invocation.


CODE QUALITY

  1. pointIndex is set but never used for navigation

navigateToExtrema uses target.groupIndex / target.categoryIndex, not target.pointIndex. This diverges from bar.ts where this.col = target.pointIndex drives navigation directly. A comment clarifying that pointIndex is set only to satisfy the ExtremaTarget interface would help future readers.

  1. Missing display field in ExtremaTarget

The interface has an optional display field documented as 'Structured display data for UI rendering. Avoids string parsing in UI components.' Worth checking whether the UI parses label strings downstream; if so, populating display is the correct fix.

  1. heatmapValues[0].length repeated six times in getExtremaTargets

Extract to a local variable:
const cols = this.heatmapValues[0]?.length ?? 0;


TESTS

e2e_tests/specs/heatmap.spec.ts has no extrema coverage. At minimum, a test that triggers the go-to-extrema dialog, navigates to global max/min, and verifies the cursor position and announcement would prevent regressions.


SUMMARY

Severity | Item
Bug | Empty first row not guarded in findGlobalExtrema / findColExtrema
Bug | NaN values produce silently incorrect extrema results
Performance | Two O(rows x cols) global scans where one pass suffices
Quality | pointIndex disconnect from navigation — add a comment
Minor | heatmapValues[0].length repeated six times — extract to variable
Tests | No E2E coverage for the new feature

The core approach is correct and well-structured. Addressing the two bugs and the redundant traversal before merging would make this solid.

@nk1408
Copy link
Collaborator

nk1408 commented Mar 9, 2026

Works nicely and looking good to me

@soundaryakp1999 soundaryakp1999 changed the title feat: go to extrema in heatmap feat: extend goto feature to work with heatmaps row, column, and global extremas using fill values Mar 10, 2026
@soundaryakp1999 soundaryakp1999 merged commit 7946bdc into main Mar 10, 2026
8 checks passed
@soundaryakp1999 soundaryakp1999 deleted the feat/heatmape_extrema branch March 10, 2026 16:13
@xabilitylab
Copy link
Collaborator

🎉 This PR is included in version 3.56.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@xabilitylab xabilitylab added the released For issues/features released label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released For issues/features released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants