-
-
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
Set Cartesian axis attributes via template #4670
Conversation
I think we should leave #4671 alone for now please... this code already works as desired for e.g. annotations. Check out this Python example: https://plot.ly/python/templates/#including-tuple-elements-in-a-theme |
In JS, it appears those were not working before | after. @nicolaskruchten @alexcjohnson am I missing something? |
This works for me with the production bundle: https://codepen.io/nicolaskruchten/pen/wvaENrm?editors=0010 |
@alexcjohnson I'll let you judge the safety of these changes, keeping in mind that I would rather keep existing bugs in the interests of getting 1.53 and 1.54 done ASAP and not introducing subtle new bugs. For 1.53 we just need |
@archmoj the way templates interact with container arrays is a bit subtle as it contains features for both defaults for all array items and overrides for specific items (which may not be at the same index in the array), but in general it works. Take a look at the original templates PR #2761, esp. this test and the Please use those for context before deciding what's a bug. |
This reverts commit 96e3590.
Ah, with respect to your before/after: you need to set |
src/plots/cartesian/axis_defaults.js
Outdated
if(containerOut.type === 'date') { | ||
var rangebreaks = containerIn.rangebreaks; | ||
if(axType === 'date') { | ||
var rangebreaks = containerIn.rangebreaks || axTemplate.rangebreaks; |
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.
This isn't quite right... []
is truthy, also axTemplate.rangeBreaks
items will extend the array if it contains named items.
Can we instead do:
handleArrayContainerDefaults(...);
if (containerOut.rangebreaks.length) {
// setConvert and gl / splom check
}
else {
delete containerOut.rangebreaks;
}
Same for tickformatstops
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.
Good idea. Done in f824902.
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.
💃 Love it. Thanks for catching these!
Commit 5f8b280 addresses #4667 i.e. to set axis
type
,rangebreaks
andtickformatstops
fromtemplate
.@plotly/plotly_js