plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Decreased show/hide trace performance

Open legg681 opened this issue 9 years ago • 5 comments

Hello,

I upgraded my plotly version from 1.16.0 to 1.25.0. With this update the delay when showing or hiding a trace got noticably longer. I tried to reproduce the issue in this codepen. When changing the plotly version from 1.16.0 to 1.25.0 in the html part the difference becomes apparent, when showing or hiding a trace.

1.16.0 feels very responsive, almost instant, whereas 1.25.0 has a very noticable lag.

legg681 avatar Apr 26 '17 12:04 legg681

Thanks for posting.

This is probably a side effect of https://github.com/plotly/plotly.js/pull/1432

etpinard avatar Apr 26 '17 13:04 etpinard

This perf decrease in indeed a side-effect of #1432 where we added double click interactions on legend items.

@marvingee #1432 was first released in v1.25.0, so we should be able to upgrade to v1.24.2 without seeing this issue.


This perf :chart_with_downwards_trend: is due to this setTimeout where we wait 300ms in case another mouse up/down combo comes in - which effectively adds 300ms to every single-click legend item interaction :turtle: .

To mitigate the problem, we could add a config option to disable double-click interactions on legend items which would remove that setTimeout when turned on.

Fixing the problem will be a little trickier. We can't make double-clicks first call the single-click restyle and then some other restyle because the first click would hide the trace and then the second click would make that same trace visible again which isn't particularly desirable.

I get the feeling that we should drop those legend double click interactions in v2. Greater than 300ms trace toggles are unacceptable (I really which I would've thought about that while reviewing #1432 :rage: )

@rpaskowitz @alexcjohnson any thoughts on this?

etpinard avatar Apr 28 '17 15:04 etpinard

I find some of the hover behaviour and the checkmark not going away but the series just becoming faded a bit weird, but here's an example of how Richshaw does it - http://code.shutterstock.com/rickshaw/examples/legend.html

The checkmarks control series visibility in the way that a single click does in Plotly, while clicking on the series name causes just that series to be shown.

Another pattern I've seen, but can't find an example of offhand is to show an 'Only' button beside or on a series, normally tied to a hover event.

rpaskowitz avatar Apr 28 '17 23:04 rpaskowitz

I like the idea of an "only" button that appears on hover - perhaps an 👁 icon at the right edge of the label? I don't think that would need to wait for v2, as no functionality would disappear, we'd just turn a doubleclick into a more specific single-click. It would also make this feature more discoverable 🎉

alexcjohnson avatar Apr 29 '17 01:04 alexcjohnson

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

gvwilson avatar Jun 10 '24 14:06 gvwilson