Skip to content

fix: cap width of columns with long names#1574

Merged
ethanalvizo merged 4 commits intodeephaven:mainfrom
ethanalvizo:1276-truncate-column-name
Oct 18, 2023
Merged

fix: cap width of columns with long names#1574
ethanalvizo merged 4 commits intodeephaven:mainfrom
ethanalvizo:1276-truncate-column-name

Conversation

@ethanalvizo
Copy link
Copy Markdown
Contributor

Closes #1276

Use the following command to test a table with a long column name

from deephaven import new_table
from deephaven.column import string_col, int_col

result = new_table([
    int_col("I1", [1, 2, 3]),
    int_col("I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I2I23", [4, 5, 6]),
])

New table render with capped column width
image

@ethanalvizo ethanalvizo self-assigned this Oct 13, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (cf1b368) 46.45% compared to head (f0628e0) 46.45%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1574      +/-   ##
==========================================
- Coverage   46.45%   46.45%   -0.01%     
==========================================
  Files         571      571              
  Lines       36030    36031       +1     
  Branches     9020     9020              
==========================================
  Hits        16738    16738              
- Misses      19240    19241       +1     
  Partials       52       52              
Flag Coverage Δ
unit 46.45% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
packages/grid/src/GridTheme.ts 100.00% <ø> (ø)
packages/grid/src/GridMetricCalculator.ts 75.46% <50.00%> (-0.13%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dsmmcken
Copy link
Copy Markdown
Contributor

image

Shouldn't it be based on available space?

treePaddingX
);
columnWidths.set(column, columnWidth);
columnWidths.set(column, Math.min(600, columnWidth));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We want this constant to be defined in the theme so it can be changed manually if needed. Take a look at the calculateColumnWidth method - we already have a minColumnWidth, we could just define a maxColumnWidth that it uses and never go over that.
Note this doesn't address #1284, but that's fine and can be addressed in a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can take on #1284 after this one. I think it'll be somewhat related anyways

@ethanalvizo ethanalvizo requested a review from mofojed October 17, 2023 00:24
@ethanalvizo ethanalvizo merged commit 876a6ac into deephaven:main Oct 18, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long column names should be truncated to a maximum width by default (but still resizeable)

3 participants