plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.92k stars 1.85k forks source link

No option for tickformat with '(' (parentheses) sign #5511

Closed OmriAroesti closed 3 years ago

OmriAroesti commented 3 years ago

As specified here, the formatting is described as the same as d3's formatting language.

However, the d3 documentation this points to mentions that "the sign can be... ( - nothing for zero or positive and parentheses for negative.".

This option, however, is not available to plotly.js. I see that the d3_format_re is in fact /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i, and does not include the ")" along with "+", "-" and "`"(space), so it defaults back to-`.

nicolaskruchten commented 3 years ago

This is likely because Plotly.js uses an older (v3) version of d3_format. We will be able to upgrade to the latest formatter soon :)

alexcjohnson commented 3 years ago

Right - until we manage to upgrade d3-format, the docs should really be pointing to the d3v3 version of the package, as we do in some of the attribute docstrings:

https://github.com/plotly/plotly.js/blob/cfa7720cafb61ff71b8991e37e5b248230624091/src/constants/docs.js#L4

nicolaskruchten commented 3 years ago

@archmoj we can close this one right?

archmoj commented 3 years ago

Resolved by #5125.