Skip to content

Instantly share code, notes, and snippets.

@ahonn
Created September 25, 2019 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahonn/6250469ce2dac0d61054706c7186e0d8 to your computer and use it in GitHub Desktop.
Save ahonn/6250469ce2dac0d61054706c7186e0d8 to your computer and use it in GitHub Desktop.
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