Skip to content

Custom scales or more advanced hoverinfo support #1008

Closed
@zbjornson

Description

@zbjornson

I need to scale data with a custom function (let's say log2). Right now I'm doing that by:

  1. Scaling my data before passing it into plotly. (easy)
  2. Determining nice locations for tick marks. (sort of painful)
  3. Setting tickvals and ticktext to the scaled and unscaled values, respectively. (easy enough)

This works okay, except that the hover info shows the transformed values (e.g. log2(x) instead of x). As far as I can tell, there's no way to change that. I would have to set hoverinfo: "none", listen to plotly_hover and implement my own tooltip.

Some solutions I can think of:

  1. Accept a custom scale function that would be applied to the data before plotting it, but not to the tick text or hoverinfo text. Might take some thought as far as making this work nicely with the axes code.
  2. Accept a function for hoverinfo that is called with some data (x, y, z, text, name probably); return value is displayed in the hover. This goes with the workaround I listed above, but also seems like a very nice feature.

This could help with #221 and any other future requests for new scales.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions