biocore / empress

A fast and scalable phylogenetic tree viewer for microbiome data analysis
BSD 3-Clause "New" or "Revised" License
45 stars 31 forks source link

Fix resizing in main legend when coloring tree by feature metadata gradient with non-numeric warning message #515

Open fedarko opened 3 years ago

fedarko commented 3 years ago

Opening a new issue since we are deferring this from #484.


A less important problem, but one that may annoy users. Currently, resizing the main legend CSS when a gradient is shown breaks things:

arghcss

This isn't a problem for the barplot legend gradients since those aren't resizable, unlike the main legend.

There are probably multiple good ways of handling this (I just spent some time looking into this). For example, we could prevent resizing the legend CSS, but that will be inconvenient when the default size of the legend is big (e.g. when coloring by Level 7 or something).

For now, one easy solution might be setting the height of the legend SVG here to a constant height, e.g. 15em (matching the barplot-layer-legend class), instead of 100%. This should only be done for the main legend and not for the barplot layer legends -- doing it for those will mess up the formatting and make the default size of the SVGs too large -- so we would need to add a conditional to the Legend JS that checks if this is for the main legend or a barplot layer (this would overlap with the discussion above about making the Legend class aware of if it's used for the main legend or for barplots).

This isn't urgent (I'd be ok merging this PR in without addressing this), so if you'd like to delay it to later that's ok.

_Originally posted by @fedarko in https://github.com/biocore/empress/pull/484#discussion_r624398291_

I vote to hold this off. I'd like to get this PR merged in ASAP so we can do a new release.

_Originally posted by @kwcantrell in https://github.com/biocore/empress/pull/484#discussion_r626181648_