plotly / plotly/plotly.js

Y-axis changes to hoverformat value when both tickformat and hoverformat are set

Open
#7,242 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

When using Plotly.js, if both tickformat and hoverformat are specified for the y-axis, the y-axis values unexpectedly change to the hoverformat values instead of displaying the tickformat values.

example code:

    yaxis2: {
        title: { text: 'Strip Widht [mm]' }, // Y-axis title
        titlefont: { color: '#004768', size: 8, standoff: 0.1 },
        tickfont: { color: '#004768', size: 8 },
        domain: [0.15, 0.80],
        linecolor: '#004768',
        // range based on strip width setpoint + tollerance + 10 mm extra
        range: [(tagValues[4] - tagValues[3] - 5), (tagValues[4] + tagValues[3] + 5)],
        tickvals: [(tagValues[4] - tagValues[3] - 3),(tagValues[4] - tagValues[3]), tagValues[4], (tagValues[4] + tagValues[3]), (tagValues[4] + tagValues[3] + 3)],
        hoverformat: '.2f',
        tickformat: '.0f',
        zeroline: false
    },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided yaxis2 configuration, keeping both tickformat: '.0f' and hoverformat: '.2f' set. Trace how the axis renders tick labels and hover labels, then verify that ticks use the tickformat while hover values retain the hoverformat.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.