google / charts

https://pub.dev/packages/charts_flutter
Apache License 2.0
2.81k stars 1.2k forks source link

LongTap/doubletap effect on legends #758

Open zheyxu opened 2 years ago

zheyxu commented 2 years ago

The current charts have legends that allow items to be toggled on/off on a legend item tap/click. Can a log tap and double click be implemented to toggle all of the other items rather than the item tapped? So, for a legend with items A B C and D, they are all displayed by default. If I tap A then A is no longer shown. If instead long tap A, then B C and D should be turned off. Any hints or thoughts. Thanks!

yuenzp commented 2 years ago

You can custom your own legends using Flutter widget such as Text button. It's not necessary to use charts_flutter's build in legends. A custom legends could do the same things as charts_flutter's build in legends could do and more than that. If you need the TextButton to act double tap behavior, you could wrap it with GestureDetector widget.

zheyxu commented 2 years ago

Thanks yuenzp! Does it mean I still use charts_flutter and I add some custom widgets. That is good solution. Is there any example code? I'd appreciate any examples.

zheyxu commented 2 years ago

Hello, https://github.com/google/charts/pull/759 I created a pull request to enable long-press function.