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

Maintain dimension mapping when possible #1698

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Aug 21, 2024

This addresses the first part of issue #1572 (cf. first bullet point in #1572 (comment)).

"when possible" means when:

  • toggling inspect mode;
  • switching to a dataset with no dimension mapper (scalar dataset, group, etc.) and back;
  • switching to a visualization with the same number of axes (e.g. between Heatmap and _Matrix _);
  • switching to a dataset with the exact same dimensions (both number and size).

maintain-dim-mapping

If the visualization changes when switching dataset, then the last two conditions must both be met for the dimension mapping state to be maintained.

In other words, the state is maintained when, for instance:

  • switching between two NXdata groups with signals with exact same dimensions and interpretations;
  • switching between an NXData group with a 1D signal (NX Line), and the signal itself (Line);
  • switching between an NXData group with a 2D+ signal with implicit or explicit image interpretation (NX Heatmap), and the signal itself (Heatmap);
  • switching between an NXData group with a 2D+ signal with spectrum interpretation (NX Line), and the signal itself if the preferredVis is Line.

maintain-dim-mapping-nx

However, the state is reset when, for instance:

  • switching between two NXData groups with signals with exact same dimensions but different interpretations (e.g. image vs spectrum);
  • switching between an NXData group with a 2D+ signal with spectum interpretation (NX Line), and the signal itself (Heatmap) when no preferredVis is set.

Copy link
Contributor Author

@axelboc axelboc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty straightforward in the end 🎉

packages/app/src/App.tsx Show resolved Hide resolved
packages/app/src/dimension-mapper/store.tsx Show resolved Hide resolved
@axelboc axelboc requested a review from loichuder August 22, 2024 09:39
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👏

@axelboc axelboc merged commit ac0b148 into main Aug 22, 2024
8 checks passed
@axelboc axelboc deleted the maintain-dim-mapping branch August 22, 2024 12:00
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.

2 participants