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]: different handlers for customizability (ticktextHandler) #1658

Closed
druvisc opened this issue May 10, 2017 · 4 comments
Closed

[feature]: different handlers for customizability (ticktextHandler) #1658

druvisc opened this issue May 10, 2017 · 4 comments

Comments

@druvisc
Copy link

druvisc commented May 10, 2017

I hope it's okay to suggest features here.

I'd like Plotly.js to expose different handlers for customization. I think currently it's only possible for events. Don't think it would be hard too implement in most cases (if a handler is defined, call it, otherwise do the usual). At least if error handling is kept to the minimum and it would be up to the user to properly define the handlers.

One of my biggest problems currently is to set up the y-axis to display si prefix scaled and padded values, so 2 decimal values are always shown, for example 60.00, 1.02k. For this purpose I have to manually calculate the tickvals and ticktext.

In an ideal scenario, there would be a ticktextHandler to whom I can attach a formatting function, receiving the corresponding tick value and returning the formatted tick text.

On a side note, could any of the contributors please point me where plotly calculates the appropriate tickvals? Turns out not to be that straightforward. I tried looking myself, but currently to no avail.

@etpinard
Copy link
Contributor

Sounds like a duplicate of #1464 unless we can come up with JSON serializable equivalent.

@druvisc
Copy link
Author

druvisc commented May 10, 2017

It is, sorry.

I'm unsure of the needs for the serializability, but if at some point handlers like these would become feasible, perhaps it could be possible to just ignore the handlers? Serialize the values which are serializable and if they weren't defined, use the the defaults like currently (ie, use default tickformat when it's not defined, but the ticktexHandler is).

@etpinard
Copy link
Contributor

Right, what you suggest is definitely doable but not something any plotly.js dev will spend time on.

The plotly.js data / layout API is designed to be JSON serializable so that it can be used on -- even grounds -- in non-JS clients.

@etpinard
Copy link
Contributor

@druvisc This issue looks stale. Closing.

If you can think of other JSON-serializable tick options we could add, feel free to open up a new issue.

Cheers.

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

No branches or pull requests

2 participants