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

feat: autowidth atomic columns #1540

Merged
merged 2 commits into from
Dec 6, 2023
Merged

feat: autowidth atomic columns #1540

merged 2 commits into from
Dec 6, 2023

Conversation

skokenes
Copy link
Contributor

@skokenes skokenes commented Dec 6, 2023

Adds auto width to fit of numeric and string columns:

  • result set is analyzed to find min/max numbers, shortest/longest strings in each relevant field
  • when rendering a field, the fixed width is determined by measuring the rendered text of the min/max value in a canvas element. This is compared against the size of the column header as well. The final width value is cached per field
  • Column widths are also clamped to a min and max size. For now these are clamped with hardcoded values but in the future we may explore doing something smarter based on available real estate

Examples

CleanShot 2023-12-06 at 09 32 26@2x CleanShot 2023-12-06 at 09 33 43@2x CleanShot 2023-12-06 at 09 34 18@2x CleanShot 2023-12-06 at 09 34 47@2x

Copy link
Collaborator

@whscullin whscullin left a comment

Choose a reason for hiding this comment

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

One comment, otherwise LGTM

packages/malloy-render/src/component/result-context.ts Outdated Show resolved Hide resolved
f = f._parent;
}
return path;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will use this a lot

@skokenes skokenes merged commit 3e611ce into main Dec 6, 2023
4 checks passed
@skokenes skokenes deleted the feat/autowidth-columns branch December 6, 2023 20:29
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