Created
September 25, 2019 10:11
-
-
Save ahonn/6250469ce2dac0d61054706c7186e0d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const onPlotClick = (event) => { | |
const { data } = event; | |
if (data) { | |
const { category } = data.point; | |
if (category !== query.category) { | |
setTimeout(() => { | |
const geom = _.first(chartRef.current.get('geoms')); | |
const item = geom.get('data').find(_.propEq('category', category)); | |
geom.setSelected(item); | |
}, 0); | |
setQuery({ | |
...query, | |
category, | |
}); | |
} else { | |
setQuery(_.omit('category', query)); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment