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

[Enhancement] Legend and traces toggling

Open fixxxr opened this issue 10 years ago • 10 comments

It will be nice if the legend could span to two or more columns and the ability to turn off all the traces expect for the one being double clicked.

Live example from the nvd3 library (http://www.nvd3.org/examples/stackedArea.html)

Thanks in advance Erlind

fixxxr avatar Jun 21 '16 11:06 fixxxr

Related community post: http://community.plot.ly/t/invert-legend-selection/2018

etpinard avatar Sep 01 '16 15:09 etpinard

PR https://github.com/plotly/plotly.js/pull/871 attempt to add this feature using a distinct double click interaction.

I'd prefer adding a legend attribute (maybe interaction: ['toggle', 'isolate', false]`) to archive this, but I'm open to suggestions.

etpinard avatar Sep 01 '16 16:09 etpinard

A new attempt at the double click interaction: #1432

rpaskowitz avatar Mar 01 '17 22:03 rpaskowitz

@etpinard I think I prefer double click actually - the decision about whether to toggle or isolate seems like it should be more user-driven than developer-driven, so making it an attribute would limit viewers' ability to interact as they please. The downside seems to me to be discoverability, but once you do discover it, isolating that trace/group seems intuitive as kind of "stronger than a single click." #1432 looks like a good start, so I'll review it.

alexcjohnson avatar Mar 02 '17 05:03 alexcjohnson

Related to this, but not sure if it should be a separate request. I would like to suggest a 3-way toggling so that an entry can be on, off or highlighted. Sometimes, when trying to visually analyze a subset of plots in a crowded graph it might help to either dim the rest or just make a selected few stand out? So you still want the context of the other plots for comparison just not at the same visibility level as the selected subset.

chrisvwn avatar Mar 09 '17 13:03 chrisvwn

I'd recommend doing something like that with a hover interaction, for example: http://c3js.org/samples/timeseries.html

Probably best as a separate issue though.

rpaskowitz avatar Mar 09 '17 20:03 rpaskowitz

Thanks @rpaskowitz. Almost exactly what I was thinking only with a little more persistence so that one can have multiple highlighted. I will start up a new issue.

chrisvwn avatar Mar 10 '17 06:03 chrisvwn

Should be doable using plotly_legendclick and plotly_legenddoubleclick added in https://github.com/plotly/plotly.js/pull/2581

etpinard avatar May 01 '18 17:05 etpinard

A related feature that would be nice is if you could set a group of traces in which only one of those traces could be active at a time. So if I have traces A, B, C, and D, I could set A, B, C to be in a group so that only one could be on at once. If I have A and D on, then turning on B or C would turn off A.

RagingRoosevelt avatar May 10 '18 15:05 RagingRoosevelt

following

lalitsc12 avatar Jul 24 '19 15:07 lalitsc12