Skip to content

Commit

Permalink
added clickannotation event
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krey committed Apr 6, 2018
1 parent d034e25 commit 0812a01
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/Graph.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export default class PlotlyGraph extends Component {
if (fireEvent) fireEvent({event: 'click'});
}
});
gd.on('plotly_clickannotation', (eventData) => {
const clickAnnotationData = eventData;
if (setProps) setProps({clickAnnotationData});
if (fireEvent) fireEvent({event: 'clickannotation'});
});
gd.on('plotly_hover', (eventData) => {
const hoverData = filterEventData(gd, eventData, 'hover');
if (!isNil(hoverData)) {
Expand Down Expand Up @@ -196,6 +201,11 @@ PlotlyGraph.propTypes = {
* Data from latest click event
*/
clickData: PropTypes.object,

/**
* Data from latest click annotation event
*/
clickAnnotationData: PropTypes.object,

/**
* Data from latest hover event
Expand Down Expand Up @@ -433,6 +443,7 @@ PlotlyGraph.propTypes = {
*/
dashEvents: PropTypes.oneOf([
'click',
'clickannotation',
'hover',
'selected',
'relayout',
Expand All @@ -452,6 +463,7 @@ PlotlyGraph.propTypes = {

PlotlyGraph.defaultProps = {
clickData: null,
clickAnnotationData: null,
hoverData: null,
selectedData: null,
relayoutData: null,
Expand Down

0 comments on commit 0812a01

Please sign in to comment.