carbon-design-system / carbon-charts

:bar_chart: :chart_with_upwards_trend:⠀Robust dataviz framework implemented using D3 & typescript
https://charts.carbondesignsystem.com
Apache License 2.0
904 stars 184 forks source link

Support event handling on the elements of the charts in React wrapper #159

Closed kalai001 closed 5 years ago

kalai001 commented 5 years ago

I am submitting a...

Issue description

React variant of charts should support ability to event listeners.

Examples:

  1. Clicking on one of the bars in Bar chart should invoke a callback method
  2. Clicking on one of the slices in Donut chart should invoke a callback method
theiliad commented 5 years ago

This is currently achievable using the code below: image

We would in the future add support for eventListeners in the component props.

For more examples of eventListeners read this: https://github.com/carbon-design-system/carbon-charts/blob/6e3c16066a2a3b91275c75f564aabe04b733812a/packages/core/demo/index.ts#L251-L274