Skip to content

Comments

Support "r" axis for non-intersecting interaction#9919

Merged
etimberg merged 10 commits intochartjs:masterfrom
luukdv:r-axis-support-for-interaction
Dec 5, 2021
Merged

Support "r" axis for non-intersecting interaction#9919
etimberg merged 10 commits intochartjs:masterfrom
luukdv:r-axis-support-for-interaction

Conversation

@luukdv
Copy link

@luukdv luukdv commented Nov 29, 2021

Fixes #9826.

@luukdv
Copy link
Author

luukdv commented Nov 29, 2021

Right now, adding a test in https://github.com/chartjs/Chart.js/blob/master/test/specs/core.interaction.tests.js for something like type: 'polarArea' and Chart.Interaction.modes.nearest(chart, evt, { axis: 'r', intersect: false }) will fail because of NaN values for various props (for example startAngle). Would be great if someone could give some pointers on the right way of setting up that ArcElement from this test, or how to do this differently.

@luukdv luukdv marked this pull request as ready for review November 29, 2021 12:31
@kurkle
Copy link
Member

kurkle commented Nov 29, 2021

I think the test you are trying to add is correct and should work. Could you just add it, so I can easily take a look?

@luukdv
Copy link
Author

luukdv commented Nov 29, 2021

I've pushed the failing WIP test.

@kurkle
Copy link
Member

kurkle commented Nov 29, 2021

I've pushed the failing WIP test.

getIndexAngle is based on number of labels, the chart has none. Adding labels fixes the elements, but it seems there is some other issue (the test hits 2 arcs).

@kurkle kurkle added this to the Version 3.7.0 milestone Nov 29, 2021
@luukdv
Copy link
Author

luukdv commented Nov 30, 2021

Thanks, that was the culprit. I also fixed the other issue (forgot to disable the legend).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interaction axis r support?

3 participants