Skip to content

Commit 95b8edc

Browse files
committed
add test
1 parent cf059c2 commit 95b8edc

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

test/jasmine/tests/axes_test.js

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,103 @@ describe('Test axes', function() {
15811581
.then(done, done.fail);
15821582
});
15831583

1584+
it('can relayout one partial range without affecting other subplots', function(done) {
1585+
var rangeX2;
1586+
var rangeX3;
1587+
var rangeX4;
1588+
var autorangeX2;
1589+
var autorangeX3;
1590+
var autorangeX4;
1591+
1592+
Plotly.newPlot(gd, {
1593+
data: [
1594+
{
1595+
xaxis: 'x',
1596+
yaxis: 'y',
1597+
y: [1000, 10, 100, 1],
1598+
},
1599+
{
1600+
xaxis: 'x2',
1601+
yaxis: 'y2',
1602+
y: [1000, 10, 100, 1],
1603+
},
1604+
{
1605+
xaxis: 'x3',
1606+
yaxis: 'y3',
1607+
y: [1000, 10, 100, 1],
1608+
},
1609+
{
1610+
xaxis: 'x4',
1611+
yaxis: 'y4',
1612+
y: [1000, 10, 100, 1],
1613+
},
1614+
],
1615+
layout: {
1616+
xaxis: {
1617+
range: [-1, null],
1618+
anchor: 'y',
1619+
domain: [0, 0.45],
1620+
},
1621+
yaxis: {
1622+
anchor: 'x',
1623+
domain: [0, 0.45],
1624+
side: 'right',
1625+
},
1626+
xaxis2: {
1627+
range: [null, 4],
1628+
anchor: 'y2',
1629+
domain: [0, 0.45],
1630+
},
1631+
yaxis2: {
1632+
anchor: 'x2',
1633+
domain: [0.55, 1],
1634+
side: 'left',
1635+
},
1636+
xaxis3: {
1637+
range: [null, -1],
1638+
autorange: 'max reversed',
1639+
anchor: 'y3',
1640+
domain: [0.55, 1],
1641+
},
1642+
yaxis3: {
1643+
anchor: 'x3',
1644+
domain: [0, 0.45],
1645+
side: 'left',
1646+
},
1647+
xaxis4: {
1648+
range: [4, null],
1649+
autorange: 'min reversed',
1650+
anchor: 'y4',
1651+
domain: [0.55, 1],
1652+
},
1653+
yaxis4: {
1654+
anchor: 'x4',
1655+
domain: [0.55, 1],
1656+
side: 'right',
1657+
}
1658+
}
1659+
}).then(function() {
1660+
rangeX2 = gd._fullLayout.xaxis2.range.slice();
1661+
rangeX3 = gd._fullLayout.xaxis3.range.slice();
1662+
rangeX4 = gd._fullLayout.xaxis4.range.slice();
1663+
1664+
autorangeX2 = gd._fullLayout.xaxis2.autorange;
1665+
autorangeX3 = gd._fullLayout.xaxis3.autorange;
1666+
autorangeX4 = gd._fullLayout.xaxis4.autorange;
1667+
1668+
return Plotly.relayout(gd, 'xaxis.range', [1, 2]);
1669+
}).then(function() {
1670+
expect(gd._fullLayout.xaxis2.range).toEqual(rangeX2);
1671+
expect(gd._fullLayout.xaxis3.range).toEqual(rangeX3);
1672+
expect(gd._fullLayout.xaxis4.range).toEqual(rangeX4);
1673+
1674+
expect(gd._fullLayout.xaxis2.autorange).toEqual(autorangeX2);
1675+
expect(gd._fullLayout.xaxis3.autorange).toEqual(autorangeX3);
1676+
expect(gd._fullLayout.xaxis4.autorange).toEqual(autorangeX4);
1677+
})
1678+
.then(done, done.fail);
1679+
});
1680+
15841681
it('should make room for the inside labels of the counter axes', function(done) {
15851682
Plotly.newPlot(gd, {
15861683
data: [{

0 commit comments

Comments
 (0)