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

Column header names do not truncate properly with wide characters #2288

Closed
mattrunyon opened this issue Nov 11, 2024 · 0 comments · Fixed by #2359
Closed

Column header names do not truncate properly with wide characters #2288

mattrunyon opened this issue Nov 11, 2024 · 0 comments · Fixed by #2359
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mattrunyon
Copy link
Collaborator

mattrunyon commented Nov 11, 2024

Description

Column header names are truncated based on an estimated width in GridRenderer.drawColumnHeader. This is problematic since column headers do not use a monospaced font. If there are many wide characters in a name, it can overflow the bounds instead of truncating.

Steps to reproduce

from deephaven import empty_table
t = empty_table(10).update(["X=ii", "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM=ii"])

Expected results

The long column name with "M" (wide character) is truncated

Actual results

image

Versions

Engine Version: 0.37.0-SNAPSHOT
Web UI Version: 0.97.0
Java Version: 17.0.12
Barrage Version: 0.6.0
Browser Name: Chrome 130
OS Name: Linux
@deephaven/js-plugin-ui: 0.22.0
@deephaven/js-plugin-plotly-express: 0.11.2
@deephaven/js-plugin-matplotlib: 0.5.0

@mattrunyon mattrunyon added bug Something isn't working triage Issue requires triage labels Nov 11, 2024
@mattrunyon mattrunyon changed the title Column header names do not truncate based on text measurement Column header names do not truncate properly with wide characters Nov 11, 2024
@vbabich vbabich removed the triage Issue requires triage label Nov 12, 2024
@vbabich vbabich added this to the November 2024 milestone Nov 12, 2024
ericlln added a commit that referenced this issue Feb 10, 2025
- Improved logic for calculating the range to truncate a string, based
on the width of the assumed largest character and smallest character for
a given font. This fixes the observed issue of wide strings not being
truncated.
- Changed column width calculation to calculate text width by iterating
through the text and adding up individual character widths which are
cached. This approach size columns more precisely than estimating based
on a single character's width and the length of the string, and does not
appear to have a significant performance impact.

Test snippet used to see if column width calculation works as expected;
resize columns to observe truncation behaviour
```
from deephaven import new_table
from deephaven.column import string_col

a = new_table([string_col("allllllllllllllllllllllllllllllllllllllllllllllll", ["a"])])
b = new_table([string_col("ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", ["b"])])
c = new_table([string_col("c", ["allllllllllllllllllllllllllllllllllllllllllllllll"])])
d = new_table([string_col("d", ["ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"])])
```
 
Closes #2288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants