Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better exponent treatment beyond SI prefixes #1930

Merged
merged 2 commits into from
Aug 5, 2017
Merged

Conversation

alexcjohnson
Copy link
Collaborator

Fixes #1920

In addition to no longer rounding the exponent to a factor of 3 when you get past the SI prefixes, I also changed it to exponentformat: 'power' there - ie "×1016" instead of "e+16" as we had before. I suspect using exponentformat: 'e' as the fallback was a decision made before we supported pseudo-html in tick labels.

screen shot 2017-08-04 at 5 30 13 pm

cc @etpinard @AndiMD

- don't round to factors of 3
- use 'power' (x10<sup>18</sup>) instead of 'e' (e+18)
* not a number, but for displaying numbers: the "minus sign" symbol is
* wider than the regular ascii dash "-"
*/
MINUS_SIGN: '\u2212'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this is only used in cartesian tick labels (and hover text) and this does get reused in other places... but I suspect there are places in other plot types where we use a regular dash that should be replaced by this one.

@rreusser
Copy link
Contributor

rreusser commented Aug 4, 2017

It's only loosely related, but this reminded me of #755 and led to #1932. 🎉 The test I added for that PR will break when this is merged and will need to be updated to fancy exponent formatting.

Otherwise this PR looks good to me. 💃

@alexcjohnson alexcjohnson merged commit 6b54152 into master Aug 5, 2017
@alexcjohnson alexcjohnson deleted the big-exponents branch August 5, 2017 02:59
@etpinard etpinard added status: reviewable bug something broken labels Aug 7, 2017
// 10^14 -> 100T
// 10^15 -> 1x10^15
// 10^16 -> 1x10^16
function beyondSI(exponent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful.

@etpinard
Copy link
Contributor

etpinard commented Aug 7, 2017

Solid work. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconistent numeric format on logarithmic axis labels
3 participants