Skip to content

Commit 6a58290

Browse files
committed
Clear the selectedData if the selection box was cleared\nThis partially fixes plotly#97 but depends on plotly/plotly.js#1911 getting fixed
1 parent e8b28e4 commit 6a58290

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/dash-core-components/src/components/Graph.react.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import React, {Component, PropTypes} from 'react';
2-
import {contains, filter, has, type} from 'ramda';
2+
import {contains, filter, has, isNil, type} from 'ramda';
33
/* global Plotly:true */
44

55
const filterEventData = (gd, eventData, event) => {
66
let filteredEventData;
77
if (contains(event, ['click', 'hover', 'selected'])) {
88
const points = [];
99

10+
/*
11+
* On unselect (double-clicking after selecting data),
12+
* the eventData is just `undefined`.
13+
* We're treating a graph with no selection data as having a
14+
* selectionData of `null` to match the initial state of the graph.
15+
*/
16+
if (isNil(eventData)) {
17+
return null;
18+
}
19+
1020
/*
1121
* remove `data`, `layout`, `xaxis`, etc
1222
* objects from the event data since they're so big

0 commit comments

Comments
 (0)