Visx: Add onClick prop to Legend component

Created on 6 Dec 2017  路  4Comments  路  Source: airbnb/visx

Can we add an onClick prop to Legend component which is invoked with the name/value of the clicked series?

馃殌enhancement

Most helpful comment

Hi @sabarnix thanks for checking out vx!

Yes absolutely, surprised I forgot to add this. Will add in v0.0.150

All 4 comments

Hi @sabarnix thanks for checking out vx!

Yes absolutely, surprised I forgot to add this. Will add in v0.0.150

How to do it in the current version?

@pisharodySrikanth see https://vx-demo.now.sh/legends for an example

<LegendItem
  onClick={() => {
    alert(`clicked: ${JSON.stringify(label)}`);
  }}
>

Hey, thanks for the prompt reply. Wondering how I missed that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roxanagirdu picture roxanagirdu  路  4Comments

techniq picture techniq  路  3Comments

esetnik picture esetnik  路  3Comments

asteroidice picture asteroidice  路  3Comments

EfosaSO picture EfosaSO  路  4Comments