Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlap resolution as function #183

Open
MikeBishop opened this issue Jun 3, 2020 · 3 comments
Open

Overlap resolution as function #183

MikeBishop opened this issue Jun 3, 2020 · 3 comments

Comments

@MikeBishop
Copy link

Obviously the ideal would be to have the ability to simply not hide any labels by adjusting position on the labels until they don't overlap. However, another solution would be to be able to provide a function which is passed a pair of overlapping labels and decides which one to show and which to hide. For example, I would prefer to hide the one with the smaller value, not the one with the smaller dataIndex.

@simonbrunel
Copy link
Member

I agree about adding the possibility to select which labels should be hidden or not, though I'm not sure the plugin needs to provide information about overlapping labels. Currently, label data are part of the private API and I would prefer to avoid exposing it. An alternative solution could be the one explained in this comment. In your example, you would provide a scriptable option for z as:

z: ({ dataset, dataIndex }) => dataset.data[dataIndex],

@MikeBishop
Copy link
Author

That seems a reasonable approach. I suspect whatever algorithm someone would use to determine precedence could easily be translated into a z-value.

@alimirakim
Copy link

I'd like to handle overlap behavior with a function so that if overlap is detected, I can change the label itself. Ex. The data label may be $123,456,789 when not overlapping, but once it detects overlap I can use a function to change the label to $123M. Is it not possible with the library's existing tools?

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

No branches or pull requests

3 participants