Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Format hover_data. Is this possible? #115

Closed
@indiana-nikel

Description

@indiana-nikel

Hello,

I couldn't seem to find this in the docs. Is it possible to format hover_data as a string for display purposes only? My use case comes from displaying dollar amounts, but the original data is float.64 so hovering over a data point does not look appealing.

My current fix requires an extra column to be added to a data frame, then that column is passed to the hover_data argument:

df['hover_text'] = df['revenue'].apply(lambda x :'${0:,.0f}'.format(x))

However, this is not a great solution. My knowledge is pretty limited with plotly so there may be better solutions I haven't been able to find currently. Perhaps with hovertemplate?

Best,
Indiana

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