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

Add minexponent attribute to control usage of SI prefixes in axis ticks #5121

Merged
merged 15 commits into from
Sep 26, 2020

Conversation

ignamv
Copy link
Contributor

@ignamv ignamv commented Sep 3, 2020

Resolves #5111

Presently, SI prefixes are not used for powers of 10 smaller than 3 (no prefixes for 10^-3, 10^-2, ..., 10^3).

The new minexponent attribute defaults to 3, which matches the current behavior. By setting it to 0, one can force the usage of SI prefixes for all powers of 10 (including 1m, 10m, ..., 1k). By setting it to a large value, one can disable SI prefixes up to a certain value (using plain numbers instead).

@plotly/plotly_js

Ignacio Martinez added 3 commits August 27, 2020 13:29
Works just like `SI`, except it uses prefixes for kilo- and milli-.
Hide SI prefix for 10^n if |n| <= minexponent
@archmoj archmoj added status: reviewable community community contribution feature something new labels Sep 3, 2020
@archmoj
Copy link
Contributor

archmoj commented Sep 3, 2020

@ignamv could you please investigate why the test image fails for these mocks?

contour_edge_cases
contour_label-thousands-suffix
funnel_axis_textangle
funnel_axis_textangle_outside
funnel_axis_textangle_start-end
gl2d_parcoords
gl2d_parcoords_2
gl2d_parcoords_large

@ignamv
Copy link
Contributor Author

ignamv commented Sep 4, 2020

Sure, I'll see if I can run the image tests locally.

@ignamv
Copy link
Contributor Author

ignamv commented Sep 7, 2020

Haven't managed to run them locally yet. These are the 4 failing images, animated to show the difference. The text wiggles 1 pixel to the left/right.
gl2d_shapes_below_traces png
gl2d_stacked_subplots png
gl2d_text_chart_basic png

gl2d_texttemplate png

@ignamv
Copy link
Contributor Author

ignamv commented Sep 8, 2020

Is it possible that the failure is not related to my changes? I see the exact same failing tests in the master branch:

https://app.circleci.com/pipelines/github/plotly/plotly.js/1206/workflows/138b256c-8dae-4215-81de-e9a22ad14b84/jobs/86606

@archmoj
Copy link
Contributor

archmoj commented Sep 8, 2020

Is it possible that the failure is not related to my changes? I see the exact same failing tests in the master branch:

https://app.circleci.com/pipelines/github/plotly/plotly.js/1206/workflows/138b256c-8dae-4215-81de-e9a22ad14b84/jobs/86606

Yes it is possible. But strangely today I was not able to rerun the workflow of this branch on the CircleCI!

@archmoj archmoj added this to the v1.56.0 milestone Sep 17, 2020
@ignamv
Copy link
Contributor Author

ignamv commented Sep 21, 2020

Hi, I was wondering if there's something left to do on my end.

@archmoj
Copy link
Contributor

archmoj commented Sep 21, 2020

Hi, I was wondering if there's something left to do on my end.

@ignamv
Thanks for the follow up. I noticed the colorbar needs an extra line after

minexponent: opts.minexponent

right after https://github.com/ignamv/plotly.js/blob/d90b39b3c7ef377bb57a9e06b7316ed524cdf807/src/components/colorbar/draw.js#L685

@archmoj
Copy link
Contributor

archmoj commented Sep 25, 2020

There are still a few comments on this PR which are not resolved.
@ignamv are you interested in finishing this PR?
FYI - a new minor may be released next week where we could potentially include this new feature.

@archmoj
Copy link
Contributor

archmoj commented Sep 26, 2020

Nicely done.
💃

@archmoj archmoj merged commit 98097ea into plotly:master Sep 26, 2020
@ignamv
Copy link
Contributor Author

ignamv commented Sep 26, 2020

Thanks! But what about the failing tests?

@archmoj
Copy link
Contributor

archmoj commented Sep 26, 2020

Thanks! But what about the failing tests?

For some strange reason, I was not able to re-run your workplace on CI. Also CI was very unstable during the past day.
But please don't worry. I am actually running the tests locally to see if this may cause a problem.

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

Successfully merging this pull request may close these issues.

Proposal: new exponentformat which uses "milli" prefix
2 participants