statgen / locuszoom

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

Unified Layout with Plot Builder #47

Closed Frencil closed 8 years ago

Frencil commented 8 years ago

What

This branch was built to address the idea put forth in #46 - a tool to be able to see an editable layout and plot side by side as an interactive Layout/Plot builder.

In building this tool a few latent bugs in initialization, layout parsing, and state I/O quickly surfaced. This led to an idea that's been brought up before coming to pass - merging the layout and state.

Unified Layout

Wherever there once was a layout and/or a state, now there's just a layout. State is still there. It's just inside layout, and it's still called state.

From this the following changes fall out:

A new demo appears in this branch - plot_builder.html. This is a simple tool that shows a plot next to a textarea filled with the current layout with simple UI and hooks to keep them in sync with one another as either is changed.

onUpdate()

To make the tool function the plot builder needed a means to know when the layout has been updated (e.g. the plot resizing, any data query, selecting elements in the plot, etc.) so this branch adds support for a user-defined onUpdate() event handler that can be added to a plot. It is automatically triggered whenever a plot's layout is effectively changed.

Status

This branch is now Development Complete.

The attention paid to backward compatibility should mean that existing LocusZoom implementations are not disrupted, unless those implementations are directly passing state objects to pre-select points on data layers. That syntax has been simplified in this branch, so that change will need to be communicated.