Closed abought closed 4 years ago
Initial sketch of proposal, as discussed with @skybullbobby earlier.
This is the first draft of a general mechanism, showing the use of events + match + custom color directives.
One area of note: the PheWAS plots we are using depend on a custom layer (called category_scatter
) with some weird behavior- in particular, it's not very good at handling custom point display options. That data layer may need some improvements to work with this new mechanism.
To try it out:
npm install && npx gulp build
Then open examples/gwas_catalog.html
in your browser using a dev server of your choice. (your IDE may do that for you).
I've updated this branch to work with how category_scatter
specifies color options.
It changes the rules for how we identify color (one object of options---> array of multiple options), in a way that is more consistent with how all our other data layers work. But it should seamlessly be backwards compatible with older phewas_scatter usages. Let me know if there are bugs.
I'll work on adding unit tests next, and keep this bug open until we get some feedback from our internal beta testers.
Per feature request by @amkwong
Purpose
We often want to connect data between layers. For example, click a point on an annotation track, and see how it lines up with the same set of points on an association plot.
This PR adds a controlled way for data layers to communicate with each other. It will only look at one field at a time, and the event can come from anywhere (including itself).
Summary of changes
match: {send: fieldname, receive: fieldname }
.match.send
, then whenever a point is clicked, that layer will broadcast the value of that point for the specified field.match.receive
will identify the points whose fieldname matches the broadcasted value. These points will be marked with a synthetic field, likelz_highlight_match
(exact name TBD).To do
plot.applyState
(not a regression, but this ticket makes it more obvious).destroyTooltip
should probably also clear selection status from a point.match
configurable/ intuitive{from: [id]}
: allow a layer to only apply to values from certain layers.Testing notes
Normally, data layers are isolated: changes to one layer do not affect others. This feature explicitly breaks that boundary: it allows one layer to trigger a full re-render of the plot.
Example to look at:
Scenarios to watch for:
color
behavior (object instead of list/primitive). It may need some tweaks to use this mechanism.