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

Commit 78ecab9

Browse files
Merge branch 'doccray-master'
2 parents c05b927 + 6ed61c8 commit 78ecab9

File tree

9 files changed

+51
-12
lines changed

9 files changed

+51
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.37.1] - 2018-11-07
6+
### Added
7+
- Added `clickannotation` event to `dcc.Graph`.
8+
See https://github.com/plotly/dash-core-components/pull/182.
9+
510
## [0.37.0] - 2018-11-04
611
### Fixed
712
- Some Input props weren't being picked up by React. Changed:
@@ -390,7 +395,6 @@ As part of the plotly.js upgrade:
390395
- Broken sourcemaps for debugging.
391396
### Added
392397
- Testing configuration for CHROMEPATH and SERVER_PROCESSES
393-
394398
## [0.22.1] - 2018-04-09
395399
### Fixed
396400
- Various bugs with the `ohlc` and `candlestick` chart type in the `dcc.Graph`

dash_core_components/Graph.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Graph(Component):
1212
in callbacks. The ID needs to be unique across all of the
1313
components in an app.
1414
- clickData (dict; optional): Data from latest click event
15+
- clickAnnotationData (dict; optional): Data from latest click annotation event
1516
- hoverData (dict; optional): Data from latest hover event
1617
- clear_on_unhover (boolean; optional): If True, `clear_on_unhover` will clear the `hoverData` property
1718
when the user "unhovers" from a point.
@@ -84,15 +85,15 @@ class Graph(Component):
8485
If using an Mapbox Atlas server, set this option to '',
8586
so that plotly.js won't attempt to authenticate to the public Mapbox server.
8687
87-
Available events: 'click', 'hover', 'selected', 'relayout', 'unhover'"""
88+
Available events: 'click', 'clickannotation', 'hover', 'selected', 'relayout', 'unhover'"""
8889
@_explicitize_args
89-
def __init__(self, id=Component.UNDEFINED, clickData=Component.UNDEFINED, hoverData=Component.UNDEFINED, clear_on_unhover=Component.UNDEFINED, selectedData=Component.UNDEFINED, relayoutData=Component.UNDEFINED, figure=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, animate=Component.UNDEFINED, animation_options=Component.UNDEFINED, config=Component.UNDEFINED, **kwargs):
90-
self._prop_names = ['id', 'clickData', 'hoverData', 'clear_on_unhover', 'selectedData', 'relayoutData', 'figure', 'style', 'className', 'animate', 'animation_options', 'config']
90+
def __init__(self, id=Component.UNDEFINED, clickData=Component.UNDEFINED, clickAnnotationData=Component.UNDEFINED, hoverData=Component.UNDEFINED, clear_on_unhover=Component.UNDEFINED, selectedData=Component.UNDEFINED, relayoutData=Component.UNDEFINED, figure=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, animate=Component.UNDEFINED, animation_options=Component.UNDEFINED, config=Component.UNDEFINED, **kwargs):
91+
self._prop_names = ['id', 'clickData', 'clickAnnotationData', 'hoverData', 'clear_on_unhover', 'selectedData', 'relayoutData', 'figure', 'style', 'className', 'animate', 'animation_options', 'config']
9192
self._type = 'Graph'
9293
self._namespace = 'dash_core_components'
9394
self._valid_wildcard_attributes = []
94-
self.available_events = ['click', 'hover', 'selected', 'relayout', 'unhover']
95-
self.available_properties = ['id', 'clickData', 'hoverData', 'clear_on_unhover', 'selectedData', 'relayoutData', 'figure', 'style', 'className', 'animate', 'animation_options', 'config']
95+
self.available_events = ['click', 'clickannotation', 'hover', 'selected', 'relayout', 'unhover']
96+
self.available_properties = ['id', 'clickData', 'clickAnnotationData', 'hoverData', 'clear_on_unhover', 'selectedData', 'relayoutData', 'figure', 'style', 'className', 'animate', 'animation_options', 'config']
9697
self.available_wildcard_properties = []
9798

9899
_explicit_args = kwargs.pop('_explicit_args')

dash_core_components/dash_core_components.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_core_components/dash_core_components.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_core_components/metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,17 @@
11651165
"computed": false
11661166
}
11671167
},
1168+
"clickAnnotationData": {
1169+
"type": {
1170+
"name": "object"
1171+
},
1172+
"required": false,
1173+
"description": "Data from latest click annotation event",
1174+
"defaultValue": {
1175+
"value": "null",
1176+
"computed": false
1177+
}
1178+
},
11681179
"hoverData": {
11691180
"type": {
11701181
"name": "object"
@@ -1470,6 +1481,10 @@
14701481
"value": "'click'",
14711482
"computed": false
14721483
},
1484+
{
1485+
"value": "'clickannotation'",
1486+
"computed": false
1487+
},
14731488
{
14741489
"value": "'hover'",
14751490
"computed": false

dash_core_components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "0.37.0",
3+
"version": "0.37.1",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",

dash_core_components/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.37.0'
1+
__version__ = '0.37.1'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "0.37.0",
3+
"version": "0.37.1",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",

src/components/Graph.react.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import PropTypes from 'prop-types';
3-
import {contains, filter, clone, has, isNil, type} from 'ramda';
3+
import {contains, filter, clone, has, isNil, type, omit} from 'ramda';
44
/* global Plotly:true */
55

66
const filterEventData = (gd, eventData, event) => {
@@ -109,6 +109,18 @@ export default class PlotlyGraph extends Component {
109109
}
110110
}
111111
});
112+
gd.on('plotly_clickannotation', eventData => {
113+
const clickAnnotationData = omit(
114+
['event', 'fullAnnotation'],
115+
eventData
116+
);
117+
if (setProps) {
118+
setProps({clickAnnotationData});
119+
}
120+
if (fireEvent) {
121+
fireEvent({event: 'clickannotation'});
122+
}
123+
});
112124
gd.on('plotly_hover', eventData => {
113125
const hoverData = filterEventData(gd, eventData, 'hover');
114126
if (!isNil(hoverData)) {
@@ -225,6 +237,11 @@ PlotlyGraph.propTypes = {
225237
*/
226238
clickData: PropTypes.object,
227239

240+
/**
241+
* Data from latest click annotation event
242+
*/
243+
clickAnnotationData: PropTypes.object,
244+
228245
/**
229246
* Data from latest hover event
230247
*/
@@ -458,6 +475,7 @@ PlotlyGraph.propTypes = {
458475
*/
459476
dashEvents: PropTypes.oneOf([
460477
'click',
478+
'clickannotation',
461479
'hover',
462480
'selected',
463481
'relayout',
@@ -484,6 +502,7 @@ PlotlyGraph.defaultProps = {
484502
.substring(2, 7),
485503
/* eslint-enable no-magic-numbers */
486504
clickData: null,
505+
clickAnnotationData: null,
487506
hoverData: null,
488507
selectedData: null,
489508
relayoutData: null,

0 commit comments

Comments
 (0)