Skip to content

Add autotickangles property #6790

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

Merged
merged 36 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
264617b
drawLabels: don't attempt to re-fix label if it is already rotated by…
my-tien Nov 22, 2023
9170f25
axis autotickangles property
my-tien Nov 22, 2023
eb3c456
autotickangles: consider number of lines when calculating min angle
my-tien Nov 22, 2023
60aa918
Change 10.json to test autotickangles
my-tien Nov 22, 2023
b70ff86
autotickangles draftlog file
my-tien Nov 22, 2023
be99b12
Achieve compatibility with ES5
my-tien Nov 23, 2023
8ec9a45
Add `noAutotickangles` option for `handleTickLabelDefaults` calls out…
my-tien Nov 23, 2023
3fa1c78
drawLabels: don't assume autotickangles exists on axis.
my-tien Nov 23, 2023
6d2501b
Fix typo noAutickangles → noAutotickangles in ternay layout_defaults
my-tien Nov 23, 2023
3f08ba8
Remove unnecessary coerceNumber property from autotickangles
my-tien Nov 24, 2023
7ff8d92
Replace suspicious infinite loop test with check to never decrease th…
my-tien Nov 24, 2023
9473029
Fix backwards-compatibility
my-tien Nov 24, 2023
4b23f99
New 10.png baseline image for testing autotickangles
my-tien Nov 25, 2023
361f61b
Choose angle with smallest absolute cosine instead of largest absolut…
my-tien Nov 29, 2023
6d3e7bd
use info_array instead of data_array for autotickangles
my-tien Nov 29, 2023
896c247
Convert prevAngle to radians as well for calculations.
my-tien Dec 5, 2023
aa6d492
Use the radians representation of prevAngle only for comparison (to f…
my-tien Dec 5, 2023
8ebf1a2
For the backwards-compatible auto angle calculation also only use rad…
my-tien Dec 5, 2023
0fdf52e
Revert description change for tickangle because other charts reusing …
my-tien Dec 8, 2023
a9b9cc8
Update description in test/plot-schema.json as well.
my-tien Dec 8, 2023
b8a8860
update plot-schema.json by running npm run schema after having starte…
my-tien Dec 8, 2023
c0e2758
Update draftlogs/6790_add.md
my-tien Dec 8, 2023
cdae996
Revert 264617bffe0252b11638e7446c6f3d562df70774 and 7ff8d92650d35f0be…
my-tien Dec 19, 2023
80dedea
Revert "Fix backwards-compatibility"
my-tien Jan 24, 2024
a5b1f3a
Add 0 to default autotickangles array
my-tien Jan 25, 2024
5f3f32c
Don't assume autotickangles exists on axis.
my-tien Jan 25, 2024
f544c2a
update baseline images and plot schema
my-tien Jan 25, 2024
7d8e607
- only coerce autotickangles for x axes with auto tickangle
alexcjohnson Jan 26, 2024
e20de82
fix colorbar noAutotickangles
alexcjohnson Jan 26, 2024
4d4e056
better colorbar fix: noAutotickangles only for vertical
alexcjohnson Jan 26, 2024
84bd54b
allow autotickangles for polar radial axes
alexcjohnson Jan 26, 2024
f646c15
schema update
my-tien Jan 26, 2024
1d47d05
new baseline image for polar_polygon-grids with rotated axis labels
my-tien Jan 26, 2024
2f6cd6f
fix jasmine tests
alexcjohnson Jan 26, 2024
c51791e
Update test/jasmine/tests/plots_test.js
archmoj Jan 26, 2024
b293a11
Update draftlogs/6790_add.md
archmoj Jan 26, 2024
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
29 changes: 22 additions & 7 deletions test/jasmine/tests/axes_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4268,16 +4268,22 @@ describe('Test axes', function() {
var op = parts[0];

var method = {
'=': 'toBe',
'=': 'toBeCloseTo',
'~=': 'toBeWithin',
grew: 'toBeGreaterThan',
shrunk: 'toBeLessThan',
initial: 'toBe'
initial: 'toBeCloseTo'
}[op];

var val = op === 'initial' ? initialSize[k] : previousSize[k];
var msgk = msg + ' ' + k + (parts[1] ? ' |' + parts[1] : '');
var args = op === '~=' ? [val, 1.1, msgk] : [val, msgk, ''];
var args = [val];
if(op === '~=') {
args.push(1.1);
} else if(method === 'toBeCloseTo') {
args.push(3);
}
args.push(msgk);

expect(actual[k])[method](args[0], args[1], args[2]);
}
Expand Down Expand Up @@ -4313,7 +4319,7 @@ describe('Test axes', function() {
width: 600, height: 600
})
.then(function() {
expect(gd._fullLayout.xaxis._tickAngles.xtick).toBe(30);
expect(gd._fullLayout.xaxis._tickAngles.xtick).toBeCloseTo(30, 3);

var gs = gd._fullLayout._size;
initialSize = Lib.extendDeep({}, gs);
Expand Down Expand Up @@ -4485,13 +4491,22 @@ describe('Test axes', function() {
var op = parts[0];

var method = {
'=': 'toBe',
'=': 'toBeCloseTo',
'~=': 'toBeWithin',
grew: 'toBeGreaterThan',
shrunk: 'toBeLessThan',
initial: 'toBeCloseTo'
}[op];

var val = initialSize[k];
var msgk = msg + ' ' + k + (parts[1] ? ' |' + parts[1] : '');
var args = op === '~=' ? [val, 1.1, msgk] : [val, msgk, ''];
var args = [val];
if(op === '~=') {
args.push(1.1);
} else if(method === 'toBeCloseTo') {
args.push(3);
}
args.push(msgk);

expect(actual[k])[method](args[0], args[1], args[2]);
}
Expand Down Expand Up @@ -4526,7 +4541,7 @@ describe('Test axes', function() {
width: 600, height: 600
})
.then(function() {
expect(gd._fullLayout.xaxis._tickAngles.xtick).toBe(30);
expect(gd._fullLayout.xaxis._tickAngles.xtick).toBeCloseTo(30, 3);

var gs = gd._fullLayout._size;
initialSize = Lib.extendDeep({}, gs);
Expand Down
7 changes: 5 additions & 2 deletions test/jasmine/tests/plots_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ describe('Test Plots with automargin and minreducedwidth/height', function() {

afterEach(destroyGraphDiv);

it('should resize the plot area when tweaking min-reduced width & height', function(done) {
fit('should resize the plot area when tweaking min-reduced width & height', function(done) {
function assert(attr, exp) {
var xy = d3Select('rect.nsewdrag')[0][0];
expect(xy.getAttribute(attr)).toEqual(exp);
Expand All @@ -1360,7 +1360,10 @@ describe('Test Plots with automargin and minreducedwidth/height', function() {
assert('height', '100');
})
.then(function() {
return Plotly.relayout(gd, 'minreducedwidth', 100);
// force tickangle to 90 so when we increase the width the x axis labels
// don't revert to 30 degrees, giving us a larger height
// this is a cool effect, but not what we're testing here!
return Plotly.relayout(gd, {minreducedwidth: 100, 'xaxis.tickangle': 90});
})
.then(function() {
assert('width', '100');
Expand Down