How to capture clicked metric value from a Pie Chart using Compose SDK?
Hi everyone,
I'm embedding a Sisense dashboard using the Compose SDK (@sisense/sdk-ui) in my React app. I can render widgets using WidgetById and everything looks fine visually.
What I'm trying to do now is capture user interaction with a Pie Chart — specifically, I want to know which pie slice the user clicked, such as the category name ("Active", "Closed", etc.).
Here’s what I’ve tried so far:
Added onWidgetClick and container onClick event handlers
Used event.detail, event.target, etc.
Tried a custom double-click workaround with setTimeout
Checked the widget configuration for drill options and filters
But none of these gave me the value or label of the clicked pie slice. The click event doesn't contain the metric/dimension value.
Context:
Using Compose SDK (@sisense/sdk-ui)
Rendering widgets from dashboard via /api/v1/dashboards/:id/widgets
Widget type: Pie Chart
Rendering via WidgetById inside SisenseContextProvider
What I need:
Is it possible to get the clicked dimension or category from a pie chart using Compose SDK?
If not, is there a workaround via classic embedding or JavaScript SDK?
Any configuration or drill setup that enables this behavior?
Thanks in advance for any guidance or examples. Would really appreciate help from someone who’s tackled this before!
Hi midhun_e
WidgetById has a prop named onDataPointClick, it should do what you want.
onDataPointClick={(point: DataPoint ) => { console.log('Data Point Clicked:', point.categoryValue); }}
Let us know if it works for you
Thanks
Steve