google / charts

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

update series_legend.dart--- add onlyKeepSerie #759

Closed zheyxu closed 1 year ago

zheyxu commented 2 years ago

click the legend and only keep the clicked legend. Greys others out

google-cla[bot] commented 2 years ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

zheyxu commented 2 years ago

charts_common/lib/src/chart/common/behavior/legend/series_legend.dart /// Only keep data for a series on the chart by [seriesId]. /// /// The other entries in the legend for this series will be grayed out to indicate /// that they are hidden. @protected void onlyKeepSeries(String seriesId) { if (!isSeriesAlwaysVisible(seriesId)) { _allSeries?.forEach((element) => _hiddenSeriesList.add(element)); _hiddenSeriesList.remove(seriesId); } }

It can be used for the long press. When user long press the legend, only the clicked ones are kept. And other legends are greyed out.

stuartmorgan commented 1 year ago

This project is no longer maintained, and cannot accept any PRs. Community members interested in collaborating on a community-maintained fork can coordinate in this issue.