Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

onClick hook: find closest datapoint #67

Merged
merged 3 commits into from
Dec 19, 2019
Merged

Conversation

jotak
Copy link
Collaborator

@jotak jotak commented Dec 17, 2019

New algorithm to find closest dp; Added stories & tests

Closes kiali/kiali#2039

- Travis build: go 1.12 and node 12
- Update pf versions to match kiali-ui
@jotak jotak self-assigned this Dec 19, 2019
Copy link
Contributor

@aljesusg aljesusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGFM

- Need to get clicked coords relative to SVG
- Need to normalize distance (in closest-point algorithm) relatively to domain amplitude
@jotak
Copy link
Collaborator Author

jotak commented Dec 19, 2019

@aljesusg I've pushed some changes, it seems to work correctly now with your PR

.add('as scatter plots with dates', () => {
return <ChartWithLegend data={[tracesXAsDates]} unit="seconds" seriesComponent={(<ChartScatter/>)} onClick={dp => alert(`${dp.name}: [${dp.x}, ${dp.y}]`)} />;
})
.add('with two series', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice addition

Copy link
Contributor

@lucasponce lucasponce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Code LGTM.

@lucasponce lucasponce merged commit 45097f7 into kiali:master Dec 19, 2019
@jotak jotak deleted the closest branch February 7, 2020 11:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[K-charted] onClick hook sometimes reports the wrong datapoint
3 participants