Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double click #1404

Closed
nergiszaim opened this issue May 22, 2020 · 9 comments
Closed

Double click #1404

nergiszaim opened this issue May 22, 2020 · 9 comments

Comments

@nergiszaim
Copy link

Description

I have multiple groups in a stack chart, and would like to see one by one. deselecting all the groups to see only one is cumbersome. Is there a double click option like in Plotly to show one series right away?

Steps to check or reproduce

@netil
Copy link
Member

netil commented May 22, 2020

Hi @nergiszaim, can you provide link demo to check?

@netil netil added the question label May 22, 2020
@nergiszaim
Copy link
Author

Sure, https://plotly.com/r/bar-charts/

Here if you double click to any legend, it will just filter that group on the chart.

@netil
Copy link
Member

netil commented May 22, 2020

There's no option doing that, but you can implement easily.
I made an example that you can take as a reference. Double clicking the legend, will hide all except the selected one.

@nergiszaim
Copy link
Author

That is awesome! Do you happen to have this example as an R code?

@kmatarese
Copy link

kmatarese commented Aug 7, 2020

It looks like c3 had this ability through a poorly documented alt-click option (commit here). It seems your library has inherited that, because I can use alt-click to select/focus a single series. Works on the examples too: https://naver.github.io/billboard.js/demo/#Chart.AreaChart.

What would be a nice addition is if you double click the item again, or perhaps also if all options have been deselected, it does the reset you put in your example above automatically. I'm also used to this being possible via double click, but alt-click is fine now that I know about it. For now I'll use the custom template approach as needed.

@netil
Copy link
Member

netil commented Aug 10, 2020

Hi @kmatarese, thanks for sharing this.

There're 2 possible actions can be taken from this:

  • alt+click Add to API doc describing this feature
  • dblclick: Considering to implement

@kmatarese
Copy link

kmatarese commented Aug 10, 2020

Seeing as alt+click wasn't really documented in C3 (I found it in a random github issue comment), if your plan is to implement double-click behavior I think it makes sense to just document that once it's ready. IMO it's a better/more standard UX anyway.

At the risk of overloading this particular issue, there are a handful of related legend improvements I would find useful. I'll mention them in case they are easy while you are implementing double-click. To add some context, in my application I can easily run into cases where there are hundreds of series being charted at once. The legend UI/UX doesn't scale that well to this scenario, though I realize it's my use case that is unusual, not the legend itself. For now I just cut the legend out over a certain threshold.

  • Ability to disable the hover behavior. I found overriding onover and onout to be empty functions prevented hover but broke other legend click logic. A simple flag for this might be useful.
  • When hover is enabled, and you click a legend item to disable it, the data is removed from the graph but the legend item remains highlighted because of the hover functionality (until you move the mouse away). I think as soon as you click to disable a data series in the legend it should become greyed out, regardless of still hovering over it.
  • If the last item is deselected, all items should reset and be selected.
  • The equally option doesn't seem to leave enough space if your data series names are longer and you have a lot of legend items. Being able to use this would help a lot when your legend item count grows, looks a lot neater.
  • A simple idea for when there would be a lot of legend items: making the legend area have a max height and have it scrollable when it overflows the Y direction
  • A less simple idea: having a "page" concept, where you could page through your legend and it would change what shows up on the graph (page size should be configurable). Would only kick in if you had a lot of series to draw, but has the added benefit of allowing scenarios where you have a lot of data/series which would otherwise really bog down the UI. This could be built externally too though.

Thanks for your help and for all of your work on this. If you'd like me to open separate issues for any of these let me know.

@netil
Copy link
Member

netil commented Aug 11, 2020

I loved to. Please open each issues as separate one, where will help manage and implement.

Thanks for your help and for all of your work on this. If you'd like me to open separate issues for any of these let me know.

@kmatarese
Copy link

* Ability to disable the hover behavior. I found overriding `onover` and `onout` to be empty functions prevented hover but broke other legend click logic. A simple flag for this might be useful.

#1598

* When hover is enabled, and you click a legend item to disable it, the data is removed from the graph but the legend item remains highlighted because of the hover functionality (until you move the mouse away). I think as soon as you click to disable a data series in the legend it should become greyed out, regardless of still hovering over it.

#1599

* If the last item is deselected, all items should reset and be selected.

I'm going to ignore this one as it's something that could be handled with your double-click implementation. If you double click an item it should show just that series. If you double click it again it should reset the chart (show all). Alternatively having an optional "reset" control in the legend could be useful. Again this becomes more of an issue when you chart many series and you don't want to have to click all of the legend items to reset.

* The `equally` option doesn't seem to leave enough space if your data series names are longer and you have a lot of legend items. Being able to use this would help a lot when your legend item count grows, looks a lot neater.

#1600

* A simple idea for when there would be a lot of legend items: making the legend area have a max height and have it scrollable when it overflows the Y direction

* A less simple idea: having a "page" concept, where you could page through your legend and it would change what shows up on the graph (page size should be configurable). Would only kick in if you had a lot of series to draw, but has the added benefit of allowing scenarios where you have a lot of data/series which would otherwise really bog down the UI. This could be built externally too though.

Combined both of these ideas into one issue: #1601

netil pushed a commit to netil/billboard.js that referenced this issue Jun 22, 2023
- Implement double click interaction and option
- Reenforce legend click interaction on API doc

Ref naver#1404
@netil netil closed this as completed in 18f5c4a Jun 22, 2023
github-actions bot pushed a commit that referenced this issue Jul 3, 2023
# [3.9.0](3.8.2...3.9.0) (2023-07-03)

### Bug Fixes

* **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221)
* **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222)
* **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254)

### Features

* **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205)
* **bar:** Intent to ship bar.front ([f7e0d80](f7e0d80)), closes [#2965](#2965)
* **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237)
* **legend:** Intent to ship legend.item.interaction.dblclick ([18f5c4a](18f5c4a)), closes [#1404](#1404)
* **legend:** Intent to ship legent.item.interaction ([af87d10](af87d10)), closes [#1598](#1598)
* **point:** Enhance point.sensitivity ([a537201](a537201)), closes [#2568](#2568)
* **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants