lineupjs icon indicating copy to clipboard operation
lineupjs copied to clipboard

Automatic column width adjustment (AutoFit)

Open nevrome opened this issue 5 years ago • 4 comments

Is there an option to adjust the column width according to the column name or according to the longest entry in a column? In MS Excel this feature is called AutoFit I think.

If no: Could you imagine adding this feature or are there some technical/visual constraints?

nevrome avatar Nov 07 '18 09:11 nevrome

Thanks for your request, we'll have to look into this. It might be difficult for all column types and visualizations (renderer). Probably we might need to set a minimum width (e.g., bar charts of numerical columns).

Would you expect that the autofit considers also the width of the header title (or just the row content)?

thinkh avatar Nov 07 '18 22:11 thinkh

Thank you for considering this!

A minimum width is probably required. Maybe it's even better to keep the fixed width for numerical columns with charts.

I believe the autofit should consider both the header and the content of a column as a default. From a user perspective it would be perfect to control this behavior with a high level configuration option.

I would love to offer a PR, but my Javascript/Typescript knowledge is pretty much nonexistent. I'm personally using lineupjs in a R shiny app with the R API.

nevrome avatar Nov 08 '18 08:11 nevrome

This feature would be great, but while its missing is there anyway to adjust column widths via the javascript api?

eric-kimbrel avatar Mar 25 '19 19:03 eric-kimbrel

when building the ranking you can specify the width: https://github.com/lineupjs/lineupjs/blob/790a0bbd36906539c27bae08ce517c27885ae56a/src/builder/column/ColumnBuilder.ts#L66

in an existing ranking you find the right column and then call https://github.com/lineupjs/lineupjs/blob/790a0bbd36906539c27bae08ce517c27885ae56a/src/model/Column.ts#L289

sgratzl avatar Mar 25 '19 19:03 sgratzl