statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
156 stars 29 forks source link

Smarter responsive resizing modes #43

Closed Frencil closed 5 years ago

Frencil commented 8 years ago

This is the continuation of a discussion started in #41 with @MrFlick and @benralexander.

Presently resizing can be none, manual, or responsive, which keeps a fixed aspect ratio.

It has been suggested that responsive could manifest in a few different ways, depending on the end use case. For example:

Are there other "responsive" modes we can think of? Both of these would be straightforward to implement. New layout syntax would be required.

pjvandehaar commented 6 years ago

I like the approach with fixed height and dynamic width. I've made a quick demo by deleting the lines https://github.com/statgen/locuszoom/blob/f33885b2f22242de021f47776602d7d8e5d4e647/assets/js/app/Plot.js#L424-L428 and moving https://github.com/statgen/locuszoom/blob/f33885b2f22242de021f47776602d7d8e5d4e647/assets/js/app/Plot.js#L418 below that conditional block and adding && false to the condition at https://github.com/statgen/locuszoom/blob/f33885b2f22242de021f47776602d7d8e5d4e647/assets/js/app/Plot.js#L462 .

  1. Is this the right approach or am I missing how this should actually work?

  2. What is the right layout parameter for this? Perhaps layout.responsive_resize = "width_only", and keep layout.responsive_resize = true as an alias for layout.responsive_resize = "preserve_aspect_ratio"?

abought commented 6 years ago

Following up on a slack discussion: I'm open to this idea, and the idea of backwards-compatible configuration seems reasonable.

Peter has volunteered to put together an initial pull request for review and followup/ testing.

abought commented 5 years ago

As this is the last major bugfix needed for 0.9, I've put together a candidate PR.

Peter, I got the sense you were experimenting, and that perhaps there were more requirements than our original notes. Are there any test cases you'd like to see considered?