Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 0812a01

Browse files
author
Martin Krey
committed
added clickannotation event
1 parent d034e25 commit 0812a01

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/components/Graph.react.js

+12
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ export default class PlotlyGraph extends Component {
9898
if (fireEvent) fireEvent({event: 'click'});
9999
}
100100
});
101+
gd.on('plotly_clickannotation', (eventData) => {
102+
const clickAnnotationData = eventData;
103+
if (setProps) setProps({clickAnnotationData});
104+
if (fireEvent) fireEvent({event: 'clickannotation'});
105+
});
101106
gd.on('plotly_hover', (eventData) => {
102107
const hoverData = filterEventData(gd, eventData, 'hover');
103108
if (!isNil(hoverData)) {
@@ -196,6 +201,11 @@ PlotlyGraph.propTypes = {
196201
* Data from latest click event
197202
*/
198203
clickData: PropTypes.object,
204+
205+
/**
206+
* Data from latest click annotation event
207+
*/
208+
clickAnnotationData: PropTypes.object,
199209

200210
/**
201211
* Data from latest hover event
@@ -433,6 +443,7 @@ PlotlyGraph.propTypes = {
433443
*/
434444
dashEvents: PropTypes.oneOf([
435445
'click',
446+
'clickannotation',
436447
'hover',
437448
'selected',
438449
'relayout',
@@ -452,6 +463,7 @@ PlotlyGraph.propTypes = {
452463

453464
PlotlyGraph.defaultProps = {
454465
clickData: null,
466+
clickAnnotationData: null,
455467
hoverData: null,
456468
selectedData: null,
457469
relayoutData: null,

0 commit comments

Comments
 (0)