Skip to content
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

882 - Chart Title Alignment #3276

Merged
merged 50 commits into from
Nov 29, 2018
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6687034
Add test of current plot title alignment [882]
rmoestl Oct 30, 2018
a7e3a9d
Transition layout titles from being strings to be objects [882]
rmoestl Oct 30, 2018
50a1e9b
Support updating titles through `relayout` and `update` [882]
rmoestl Oct 31, 2018
4d21886
Deprecate `*.titlefont` attributes in favor of `*.title.font` [882]
rmoestl Nov 5, 2018
66a8154
Implement basic chart title alignment options [882]
rmoestl Nov 7, 2018
6f583a4
Add test to ensure current chart title position is still supported [882]
rmoestl Nov 8, 2018
185772b
Implement 'auto' values for title's `xanchor` and `yanchor` [882]
rmoestl Nov 12, 2018
ac3649b
Support deprecated axes titles syntax for multiple axes [882]
rmoestl Nov 13, 2018
493b6ec
Adapt axes tests to new `title` structure [882]
rmoestl Nov 14, 2018
4d7c4b3
Adapt axes auto-margin code to new `title` structure [882]
rmoestl Nov 14, 2018
96df782
Adapt `axes.swap` to new `title` attr structure [882]
rmoestl Nov 14, 2018
43da557
Adapt colorbar to new title attr structure [882]
rmoestl Nov 13, 2018
9e2cbfe
Adapt rangeslider to new title attr structure [882]
rmoestl Nov 14, 2018
f632a7d
Transition polar plot type to new title attr structure [882]
rmoestl Nov 15, 2018
b3367f1
Adapt legacy polar chart to new title attr structure [882]
rmoestl Nov 15, 2018
cf7f493
Transition ternary plot type to new title attr structure [882]
rmoestl Nov 15, 2018
573c90d
Deduplicate transitioning to new title structure in `cleanLayout` [882]
rmoestl Nov 15, 2018
ddf9c0b
Transition gl3d plot type to new title attr structure [882]
rmoestl Nov 15, 2018
0e144b6
Transition gl2d plot type to new title attr structure [882]
rmoestl Nov 15, 2018
984aa46
Expect new title syntax in legend, lib and further tests [882]
rmoestl Nov 15, 2018
58f402a
Reactivating editing plot title [882]
rmoestl Nov 15, 2018
5e16b02
Also call cleanLayout on `layout.template.layout` [882]
rmoestl Nov 16, 2018
7a81f27
Adjust hover template test to new title structure [882]
rmoestl Nov 20, 2018
e53e546
Adapt clonePlot function to new title attr structure [882]
rmoestl Nov 20, 2018
ca920ab
Implement padding for chart title alignment [882]
rmoestl Nov 20, 2018
37bb68c
Restrict title.y (and x) to a number between 0 and 1 [882]
rmoestl Nov 20, 2018
e438a3f
Edit attribute descriptions for new title attr structure [882]
rmoestl Nov 21, 2018
b37950d
Minor clean up in subroutines.js [882]
rmoestl Nov 21, 2018
0c2bfd7
Fix cleaning deprecated title structure on relayout/update [882]
rmoestl Nov 21, 2018
eda4f72
Fix `cleanLayout` bug [882]
rmoestl Nov 21, 2018
53ea94d
Remove small piece of obsolete code in gl3d's convert module [882]
rmoestl Nov 21, 2018
f896273
Still accept numbers as titles when defined in deprecated notation [882]
rmoestl Nov 22, 2018
f7b652b
Improve and simplify title compatibility code for relayout [882]
rmoestl Nov 22, 2018
1288121
Clear TODOs in gl3d axis_defaults.js and cloneplot.js [882]
rmoestl Nov 22, 2018
ee613bb
Streamline variable names in subroutines.js [882]
rmoestl Nov 23, 2018
678c2d9
Deprecate old title structure properly [882]
rmoestl Nov 23, 2018
598fc5f
Fix plotschema_test.js to embrace deprecated attribute containers [882]
rmoestl Nov 23, 2018
4efb546
Make explanatory comment in polar.js more clear [882]
rmoestl Nov 23, 2018
014548c
Skip overriding deprecated title attributes in polar [882]
rmoestl Nov 26, 2018
1117113
Reuse Lib.counterRegex to match deprecated title string attributes [882]
rmoestl Nov 26, 2018
c2b4c10
Pass back update data unmodified to plotly_relayout event handlers [882]
rmoestl Nov 26, 2018
86a88e2
Move legend's anchor_utils to Lib and use them in title alignment [882]
rmoestl Nov 23, 2018
5fb7b8f
Redeclare valType of title.y to be a 'number' [882]
rmoestl Nov 26, 2018
d600bbd
Merge branch 'master' into 882-chart-title-alignment
rmoestl Nov 27, 2018
a2f0543
Transition pie trace type to new title attr structure [882]
rmoestl Nov 27, 2018
a4e43a6
Transition color bar to new title attr structure [882]
rmoestl Nov 27, 2018
e4dbc5d
Transition carpet to new title attr structure [882]
rmoestl Nov 28, 2018
ef9e078
Refactor code to clean up deprecated title attr structure [882]
rmoestl Nov 28, 2018
e3bcf7c
Let '' be the default carpet axes title [882]
rmoestl Nov 28, 2018
2b26746
Reverse coerce logic for carpet axes titles [882]
rmoestl Nov 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/traces/carpet/axis_attributes.js
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ module.exports = {
title: {
text: {
valType: 'string',
dflt: '',
role: 'info',
editType: 'calc',
description: [
5 changes: 5 additions & 0 deletions src/traces/carpet/axis_defaults.js
Original file line number Diff line number Diff line change
@@ -203,6 +203,11 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options)
// but no, we *actually* want to coerce this.
coerce('tickmode');

if(!containerOut.title.text) {
delete containerOut.title.font;
delete containerOut.title.offset;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some reason it doesn't work to invert this pattern? ie only coerce these attributes if we have a title, rather than always coercing them then deleting if there's no title?

There is a lot of this pattern above - coerce everything and then delete - and it's needed when a value provided to one of these other attributes affects the default of the controlling attribute - like if there's an explicit start line color or width we default to show the start line, so we need to coerce startlinecolor and startlinewidth before we can correctly coerce startline but then if start line was explicitly hidden we need to delete color and width. But I don't think that applies here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some reason it doesn't work to invert this pattern?

I don't think so, but I can't say for sure TBH. What could be a reason for checking for an empty title and deleting title attributes at the end? In theory, every call to coerce could clear containerOut.title. But since there's no comment on the "why", let's reverse the logic as you suggested and keep 🤞 we haven't broke anything. Does that sound like a plan?


return containerOut;
};