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

Feature request: 'round' option for individual x/y axis #99

Open
ffongmdsp opened this issue Jun 27, 2022 · 2 comments
Open

Feature request: 'round' option for individual x/y axis #99

ffongmdsp opened this issue Jun 27, 2022 · 2 comments

Comments

@ffongmdsp
Copy link

Hello,

Currently there is 'round' option - it helps my use-case tremendously. On the other hand, the x and y axes require different precision. 0.1 for x and 0 for y. Now I would do a Math.round() on the y-axis value given by onDrag(). Therefore, I think it would be useful to be able to set 'round' value on individual axis.

@chrispahm
Copy link
Collaborator

Hey @ffongmdsp,

Thanks for raising an issue!
Is there a particular reason why rounding the value in the onDrag callback wouldn't work for you? I'd argue this gives the greatest flexibility for all use cases, even if you require different rounding strategies for different datasets/indeces.

While the standard rounding option is frequently used, I guess this option would be used too seldom in order to justify the additional code that would need to be maintained in the long run. But maybe I'm missing something?

For the sake of completeness, I created a small fiddle incorporating a custom rounding logic in the onDrag callback just if anyone could use a demo of the functionality:
https://jsfiddle.net/jhvp6fbk/1/

@ffongmdsp
Copy link
Author

Thanks a lot for the effort to explain. For me it is a matter of code re-use and API design. The plugin has already implemented 'round' function, I would guess that it is be relatively trivial to separate them into round-x and round-y, similar to the option dragX and dragY.

There is no problem with doing the separate rounding at onDrag() callback, that is what I have been doing.

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

2 participants