mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[charts] Allow `onItemClick` on the `Legend` component

Open JCQuintas opened this issue 1 year ago • 6 comments

  • Works on ChartsLegend and PiecewiseColorLegend

  • Allows simple customisation of behavior, not sure it is worth documenting 🤔

  • Should we try to provide this for ContinuousColorLegend? We could try to extrapolate the current color or value the user is clicking on and pass it to the user 🤔

Would be a middleground quick-win for #12344, though no actions yet

JCQuintas avatar Aug 16 '24 10:08 JCQuintas

Deploy preview: https://deploy-preview-14231--material-ui-x.netlify.app/

Updated pages:

Generated by :no_entry_sign: dangerJS against 9268123b3e2d0b2d329f05a98686fb06c76c89c4

mui-bot avatar Aug 16 '24 10:08 mui-bot

CodSpeed Performance Report

Merging #14231 will not alter performance

Comparing JCQuintas:12344-charts-legend-actions-eg-highlighting (9268123) with master (4f2a244)

Summary

✅ 3 untouched benchmarks

codspeed-hq[bot] avatar Aug 16 '24 10:08 codspeed-hq[bot]

Should we try to provide this for ContinuousColorLegend? We could try to extrapolate the current color or value the user is clicking on and pass it to the user 🤔

I'm wondering if we add just the onItem click are we shooting in our foot for a more interactive ContinuousColorLegend. It might be complicated to add range handlers if we already have a onItemClick.

Do you have a specific uscase in mind that would be possible to create with this onItemClick for continuous range?

alexfauquette avatar Aug 19 '24 15:08 alexfauquette

Do you have a specific uscase in mind that would be possible to create with this onItemClick for continuous range?

Not really, it was just a thought that occurred to me when I noticed the continuous label is very different from the others.

I suspect behaviour could be derived for things like, click on 1.54 on the continuous scale the user could filter whatever they like (values between 0.54 to 2.54, but I left it as a comment mostly because I don't see much value in that 😅

JCQuintas avatar Aug 19 '24 15:08 JCQuintas

Not really, it was just a thought that occurred to me when I noticed the continuous label is very different from the others.

Ok, then waiting for an explicit request from a user might be the best approach

alexfauquette avatar Aug 20 '24 08:08 alexfauquette

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 27 '24 12:08 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 29 '24 08:08 github-actions[bot]

Waiting for resolution of https://github.com/mui/mui-x/pull/14391 and https://github.com/mui/mui-x/pull/14392 before finalising this

JCQuintas avatar Aug 29 '24 19:08 JCQuintas

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 30 '24 09:08 github-actions[bot]