-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Clean subplots #2227
Clean subplots #2227
Changes from 4 commits
687a2e2
9a18062
2c9d90f
3625be4
2de217e
b94ad8e
c88e8c2
26aaffc
276d1d3
c49007e
698561c
8804311
4786b6e
6e62b35
0506f88
2aa1545
44060db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,10 +341,13 @@ module.exports = function draw(gd, id) { | |
} | ||
} | ||
|
||
container.selectAll('.cbfills,.cblines,.cbaxis') | ||
container.selectAll('.cbfills,.cblines') | ||
.attr('transform', 'translate(0,' + | ||
Math.round(gs.h * (1 - cbAxisOut.domain[1])) + ')'); | ||
|
||
cbAxisOut._axislayer.attr('transform', 'translate(0,' + | ||
Math.round(-gs.t) + ')'); | ||
|
||
var fills = container.select('.cbfills') | ||
.selectAll('rect.cbfill') | ||
.data(filllevels); | ||
|
@@ -433,7 +436,7 @@ module.exports = function draw(gd, id) { | |
selection: d3.select(gd).selectAll('g.' + cbAxisOut._id + 'tick'), | ||
side: opts.titleside, | ||
offsetLeft: gs.l, | ||
offsetTop: gs.t, | ||
offsetTop: 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this fix #970 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe #1396 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
maxShift: fullLayout.width | ||
}, | ||
attributes: {x: x, y: y, 'text-anchor': 'middle'}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -858,3 +858,29 @@ lib.templateString = function(string, obj) { | |
return getterCache[key]() || ''; | ||
}); | ||
}; | ||
|
||
/* | ||
* alphanumeric string sort, tailored for subplot IDs like scene2, scene10, x10y13 etc | ||
*/ | ||
var char0 = 48; | ||
var char9 = 57; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. brilliant ✨ |
||
lib.subplotSort = function(a, b) { | ||
var l = Math.min(a.length, b.length) + 1; | ||
var numA = 0; | ||
var numB = 0; | ||
for(var i = 0; i < l; i++) { | ||
var charA = a.charCodeAt(i) || 0; | ||
var charB = b.charCodeAt(i) || 0; | ||
var isNumA = charA >= char0 && charA <= char9; | ||
var isNumB = charB >= char0 && charB <= char9; | ||
|
||
if(isNumA) numA = 10 * numA + charA - char0; | ||
if(isNumB) numB = 10 * numB + charB - char0; | ||
|
||
if(!isNumA || !isNumB) { | ||
if(numA !== numB) return numA - numB; | ||
if(charA !== charB) return charA - charB; | ||
} | ||
} | ||
return numB - numA; | ||
}; |
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.
hmm, I should have just ignored the changes to this file, since they're only line number changes... I should revisit this so it doesn't get regenerated just because you run
test-syntax
locally.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.
As a rule, I believe we should only commit changes to files in
dist/
when runningnpm version
.