-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add new formatting options by replacing d3.format method with more recent d3-format module
#5125
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
Conversation
|
Cool! Does this sidestep the challenges encountered in #5023 ? |
9c20e84 to
427e5e3
Compare
427e5e3 to
efaebd7
Compare
efaebd7 to
b59b1fb
Compare
b59b1fb to
fb0e62e
Compare
fb0e62e to
9f51808
Compare
9b69f1e to
cd0d392
Compare
- centralize and wrap require d3 format in lib - adjust old and new formats
package.json
Outdated
| }, | ||
| "dependencies": { | ||
| "@plotly/d3": "3.7.0", | ||
| "@plotly/d3": "git://github.com/plotly/d3.git#3fc195e30e85b008238783379d2aa067c737e636", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d3.format method with more recent d3-format module
Co-authored-by: Alex Johnson <[email protected]>
src/lib/index.js
Outdated
| }; | ||
|
|
||
| lib.beginCap = function(str) { | ||
| return str.charAt(0).toUpperCase() + str.slice(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 723 to 725 in bdb69fc
| lib.titleCase = function(s) { | |
| return s.charAt(0).toUpperCase() + s.substr(1); | |
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 1efc41e
| Lib.adjustFormat(formatStr) | ||
| ); | ||
| } catch(e) { | ||
| return Lib.noFormat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this catching invalid format strings? Do we want to lib.warn when this happens, to help people fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 878034b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 after those couple of comments and merging/publishing plotly/d3#4
Nice job with lib.adjustFormat!
An attempt to replace old d3 format functions with latest
d3-numbermodule as part of d3 bump cc: #424; while keep trimming the default option which was quite tricky.TODO:
d3.formatfromplotly/d3fork and use it hereAlso to note:
d3.timefromplotly/d3fork and switched tod3-timemodule in dc0d9cb cc: Bumping d3 #424@plotly/plotly_js
PR to help maintain previous behavior: https://github.com/plotly/plotly.js/pull/5820/files
Added new functionalities illustrated in
lib_number_format_test.js785f128Also see extra options tested in #5842.