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

Remove column truncation #124

Merged

Conversation

ezmiller
Copy link
Contributor

@ezmiller ezmiller commented Apr 1, 2022

Problem

When there are a lot of columns in a table rendered using the nextjournal.clerk.sci-viewer/table-viewer, the column names are truncated:

This makes the exploration of datasets with many columns very difficult.

(One) Solution

One fix seems to be to remove the tailwind truncate class that is being used on the markup for the table, and to modify the CSS slightly to layout the value so it is lined up against the edge of the column name:

image

This way of handling things mimics how, for example, Pandas dataframes are rendered in a python notebook:

image

@ezmiller
Copy link
Contributor Author

ezmiller commented Apr 2, 2022

Interestingly, once the column names do not collapse it looks like the number of columns displayed is limited, but not the column names. As seen here:

image

But this also seems a bit out of scope for this PR perhaps...

The issue seems to be that the value that value that table-viewer receives as data contains only 21 rows (max?). This line is pulling the number of columns from that value.

@ezmiller ezmiller marked this pull request as draft April 2, 2022 07:26
@@ -481,9 +481,8 @@
:title (if (or (string? k) (keyword? k)) (name k) (str k))}
[:div.inline-flex
;; Truncate to available col width without growing the table
[:div.table.table-fixed.w-full.flex-auto
{:style {:margin-left -12}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, looking at examples in notebooks/viewers/table.clj this seems to align certain columns correctly. Most of the tables look weird without this. Eg.:
image
But then my test looks strange with it:
image

ezmiller and others added 4 commits April 5, 2022 22:13
@philippamarkovics philippamarkovics marked this pull request as ready for review April 6, 2022 15:29
@philippamarkovics philippamarkovics merged commit d2eadab into nextjournal:main Apr 6, 2022
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