plotly / dash-bio

Open-source bioinformatics components for Dash
https://dash-gallery.plotly.host/Portal/?search=Bioinformatics
MIT License
531 stars 192 forks source link

Fix needle plot domain annotations and add textangle prop #565

Closed HammadTheOne closed 3 years ago

HammadTheOne commented 3 years ago

Closes #546 Closes #517

About

Description of changes

This PR reduces the XSPAN_RATIO for the NeedlePlot component so that domain annotations are more regularly aligned to the domains they belong to, and only aligned right when the domain length is short enough for it to be appropriate.

This should make for a more consistent annotation scheme. This PR also exposes the textangle prop to allow the domain annotation orientation to be rotated relative to the horizontal axis.

@alexcjohnson Do you have any thoughts on the ANGLE_OFFSET calculation? It's intended to increase the distance between the domain divider and the annotation as the text is angled more sharply, but I'm curious if there's a better method of doing so rather than using ratios.

image

HammadTheOne commented 3 years ago

With bd53eef I added a slightly modified version of the filterEventData function found in dcc.Graph to enable clickData and selectData.

image

Only remaining problem I'm seeing now is when selecting points with selectData, I encounter an error where this.gd is undefined, when the same reference works for clickData. I'll dig a little bit more to find out the source of this behaviour.