-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add sync option to tickmode
of cartesian axes to sync ticks with overlaying
axis
#6356
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
Changes from 10 commits
e982570
b68537e
debd59b
c3fcb6d
48e60c2
6a4a5ba
76debab
4ab851e
e983614
6446faf
e62be46
93f4a8e
22c703a
3fb6996
e4909bf
7590ef8
3f5e118
ed7b3ee
6352d93
b03faea
b5e957b
6fd182c
a4417a6
8c25bf6
5d5c8da
bb3e7ae
262141b
92281af
5ad0185
8ddfcc3
ea84512
434d703
77dee05
25d015c
0ff7ca5
3a87dd4
179dd5b
a08766b
5afad5e
7a9f1e7
16aa4be
74509ef
43e17de
45616b4
30ebad1
ac768c0
3ca4aed
f28ee6c
9dd3003
12ae78b
0e35a0f
685bef6
6c363ad
fd78e8d
795350a
50165f6
04cc07e
6e317d4
196b7dd
25e1389
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,6 +28,8 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if(tickmode === 'auto') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coerce(prefix + 'nticks'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else if(tickmode === 'sync') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coerce('overlaying'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. @alexcjohnson what do you suggest here? It looks like we shouldn't use plotly.js/src/plots/cartesian/layout_attributes.js Lines 928 to 947 in b03f295
Instead plotly.js/src/plots/cartesian/position_defaults.js Lines 65 to 70 in b03f295
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. If I'm understanding this correctly, the situation we want to avoid is So what I'd suggest is to leave that block out here, but fix it when we DO have enough information to do that - right after that spot @archmoj pointed to where we coerce
If we get in there with if(containerOut.tickmode === 'sync') {
containerOut.tickmode = 'auto';
coerce('nticks');
} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else if(tickmode === 'linear') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// dtick is usually a positive number, but there are some | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// special strings available for log or date axes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"name": "Apples", | ||
"type": "bar", | ||
"x": [ | ||
"Jan", | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May" | ||
], | ||
"y": [ | ||
232, | ||
2506, | ||
470, | ||
1864, | ||
-190 | ||
] | ||
}, | ||
{ | ||
"name": "Oranges", | ||
"type": "scatter", | ||
"x": [ | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May" | ||
], | ||
"y": [ | ||
-0.8, | ||
0.09, | ||
0.01, | ||
0.13, | ||
0.42 | ||
], | ||
"yaxis": "y2" | ||
} | ||
], | ||
"layout": { | ||
"margin": { | ||
"t": 40, | ||
"r": 70, | ||
"b": 40, | ||
"l": 70 | ||
}, | ||
"width": 700, | ||
"legend": { | ||
"orientation": "h", | ||
"x": 0.6, | ||
"y": 1.1 | ||
}, | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"yaxis": { | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"title": { | ||
"text": "Apples" | ||
}, | ||
"side": "left", | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"range": [ | ||
0, | ||
2506 | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
}, | ||
"yaxis2": { | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"title": { | ||
"text": "Oranges" | ||
}, | ||
"side": "right", | ||
"range": [ | ||
0, | ||
0.42 | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
"overlaying": "y", | ||
"tickmode": "sync", | ||
"zeroline": false | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.