fluentui
fluentui copied to clipboard
react-charting: Add controlled selection to Legends component
This PR adds controlled selection to the Legends component in @fluentui/react-charting.
With controlled selection, we allow the parent component to add additional integrations that interact with the selection state (for example, a button that selects all items, or a separate control that allows selecting grouped subsets of items).
Previous Behavior
Legends component allows setting initial selection via props, but does not allow fully-controlled selection behavior.
New Behavior
Legends component now supports fully-controlled selection behavior.
Related Issue(s)
None.
Team, thank you for your review! Please let me know if there are any additional changes that need to happen. Do I need to update any documentation, for example to add an example of a controlled legend selection to the React Charting demo site?
@insaneinside Could you add the scenario where this behavior is required in the PR description. We have a legends onChange handler callback when a legend value changes.
It would be great if you could add an example as well. You can add the example under react-examples/src/react-charting/Legends
/azp run
Azure Pipelines successfully started running 4 pipeline(s).
📊 Bundle size report
✅ No changes found
There are some formatting and lint errors reported in the PR build. https://uifabric.visualstudio.com/fabricpublic/_build/results?buildId=362233&view=logs&j=258ec178-2d8b-5611-7b9b-60c5c95dae55&t=cc94c182-d6f4-5dae-734d-3676c12cee2a
Could you add some margin between the example button and legend control in the example that you have added. It is looking misaligned currently.
Thanks for implementing the changes @cjsut . Changes in this PR have been validated and merged in #33436