Uh oh!
There was an error while loading. Please reload this page.
Set Cartesian axis attributes via template - #4670
Conversation
nicolaskruchten
commented
Mar 23, 2020
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 |
archmoj
commented
Mar 23, 2020
In JS, it appears those were not working before | after. @nicolaskruchten@alexcjohnson am I missing something? |
nicolaskruchten
commented
Mar 23, 2020
This works for me with the production bundle: https://codepen.io/nicolaskruchten/pen/wvaENrm?editors=0010 |
nicolaskruchten
commented
Mar 23, 2020
@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 |
alexcjohnson
commented
Mar 23, 2020
@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.
nicolaskruchten
commented
Mar 23, 2020
Ah, with respect to your before/after: you need to set |
Uh oh!
There was an error while loading. Please reload this page.
| if(containerOut.type === 'date') { | ||
| var rangebreaks = containerIn.rangebreaks; | ||
| if(axType === 'date') { | ||
| var rangebreaks = containerIn.rangebreaks || axTemplate.rangebreaks; |
There was a problem hiding this comment.
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{deletecontainerOut.rangebreaks;}Same for tickformatstops
alexcjohnson
left a comment
There was a problem hiding this comment.
💃 Love it. Thanks for catching these!
Commit 5f8b280 addresses #4667 i.e. to set axis
type,rangebreaksandtickformatstopsfromtemplate.@plotly/plotly_js