plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash

Home Page:https://plotly.com/javascript/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combining rangemode tozero and tickformat set to "," produces unexpected results

luka-mikec opened this issue · comments

Hello, as described in the title, using a combination of these two parameters sometimes causes very unusual tick labels (xyz...e-17). Whether it happens or not depends on the data provided. Here is one example causing it.

const data = [
    {
      "x": [1],
      "y": [-0.6],
      "yaxis": "y"
    }
];

const layout = {
    "yaxis": {
      "rangemode": "tozero",
      "tickformat": ","
    },
};

const graph = document.getElementById("graph")
Plotly.newPlot(graph, data, layout, {displaylogo: false});

Codepen link

The same issue happens if "rangemode": "tozero" is replaced with "range": [-0.7, 0]