Skip to content

Commit ef14d60

Browse files
committed
add jasmine tests for axes with rangebreaks and set dtick
1 parent 6b77b31 commit ef14d60

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

test/jasmine/tests/axes_test.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5022,6 +5022,132 @@ describe('Test axes', function() {
50225022
.catch(failTest)
50235023
.then(done);
50245024
});
5025+
5026+
[true, 'reversed'].forEach(function(autorange) {
5027+
it('with ' + autorange + ' autorange, should include requested ticks using tick0 and dtick with rangebreaks', function(done) {
5028+
var fig = {
5029+
data: [{
5030+
x: [
5031+
'1970-01-01 06:00', '1970-01-01 07:00', '1970-01-01 08:00', '1970-01-01 09:00', '1970-01-01 10:00', '1970-01-01 11:00', '1970-01-01 12:00', '1970-01-01 13:00', '1970-01-01 14:00', '1970-01-01 15:00', '1970-01-01 16:00', '1970-01-01 17:00', '1970-01-01 18:00',
5032+
'1970-01-02 06:00', '1970-01-02 07:00', '1970-01-02 08:00', '1970-01-02 09:00', '1970-01-02 10:00', '1970-01-02 11:00', '1970-01-02 12:00', '1970-01-02 13:00', '1970-01-02 14:00', '1970-01-02 15:00', '1970-01-02 16:00', '1970-01-02 17:00', '1970-01-02 18:00',
5033+
'1970-01-03 06:00', '1970-01-03 07:00', '1970-01-03 08:00', '1970-01-03 09:00', '1970-01-03 10:00', '1970-01-03 11:00', '1970-01-03 12:00', '1970-01-03 13:00', '1970-01-03 14:00', '1970-01-03 15:00', '1970-01-03 16:00', '1970-01-03 17:00', '1970-01-03 18:00',
5034+
'1970-01-04 06:00', '1970-01-04 07:00', '1970-01-04 08:00', '1970-01-04 09:00', '1970-01-04 10:00', '1970-01-04 11:00', '1970-01-04 12:00', '1970-01-04 13:00', '1970-01-04 14:00', '1970-01-04 15:00', '1970-01-04 16:00', '1970-01-04 17:00', '1970-01-04 18:00',
5035+
'1970-01-05 06:00', '1970-01-05 07:00', '1970-01-05 08:00', '1970-01-05 09:00', '1970-01-05 10:00', '1970-01-05 11:00', '1970-01-05 12:00', '1970-01-05 13:00', '1970-01-05 14:00', '1970-01-05 15:00', '1970-01-05 16:00', '1970-01-05 17:00', '1970-01-05 18:00',
5036+
'1970-01-06 06:00', '1970-01-06 07:00', '1970-01-06 08:00', '1970-01-06 09:00', '1970-01-06 10:00', '1970-01-06 11:00', '1970-01-06 12:00', '1970-01-06 13:00', '1970-01-06 14:00', '1970-01-06 15:00', '1970-01-06 16:00', '1970-01-06 17:00', '1970-01-06 18:00',
5037+
'1970-01-07 06:00', '1970-01-07 07:00', '1970-01-07 08:00', '1970-01-07 09:00', '1970-01-07 10:00', '1970-01-07 11:00', '1970-01-07 12:00', '1970-01-07 13:00', '1970-01-07 14:00', '1970-01-07 15:00', '1970-01-07 16:00', '1970-01-07 17:00', '1970-01-07 18:00',
5038+
'1970-01-08 06:00', '1970-01-08 07:00', '1970-01-08 08:00', '1970-01-08 09:00', '1970-01-08 10:00', '1970-01-08 11:00', '1970-01-08 12:00', '1970-01-08 13:00', '1970-01-08 14:00', '1970-01-08 15:00', '1970-01-08 16:00', '1970-01-08 17:00', '1970-01-08 18:00',
5039+
'1970-01-09 06:00', '1970-01-09 07:00', '1970-01-09 08:00', '1970-01-09 09:00', '1970-01-09 10:00', '1970-01-09 11:00', '1970-01-09 12:00', '1970-01-09 13:00', '1970-01-09 14:00', '1970-01-09 15:00', '1970-01-09 16:00', '1970-01-09 17:00', '1970-01-09 18:00',
5040+
'1970-01-10 06:00', '1970-01-10 07:00', '1970-01-10 08:00', '1970-01-10 09:00', '1970-01-10 10:00', '1970-01-10 11:00', '1970-01-10 12:00', '1970-01-10 13:00', '1970-01-10 14:00', '1970-01-10 15:00', '1970-01-10 16:00', '1970-01-10 17:00', '1970-01-10 18:00',
5041+
'1970-01-11 06:00', '1970-01-11 07:00', '1970-01-11 08:00', '1970-01-11 09:00', '1970-01-11 10:00', '1970-01-11 11:00', '1970-01-11 12:00', '1970-01-11 13:00', '1970-01-11 14:00', '1970-01-11 15:00', '1970-01-11 16:00', '1970-01-11 17:00', '1970-01-11 18:00',
5042+
'1970-01-12 06:00', '1970-01-12 07:00', '1970-01-12 08:00', '1970-01-12 09:00', '1970-01-12 10:00', '1970-01-12 11:00', '1970-01-12 12:00', '1970-01-12 13:00', '1970-01-12 14:00', '1970-01-12 15:00', '1970-01-12 16:00', '1970-01-12 17:00', '1970-01-12 18:00',
5043+
'1970-01-13 06:00', '1970-01-13 07:00', '1970-01-13 08:00', '1970-01-13 09:00', '1970-01-13 10:00', '1970-01-13 11:00', '1970-01-13 12:00', '1970-01-13 13:00', '1970-01-13 14:00', '1970-01-13 15:00', '1970-01-13 16:00', '1970-01-13 17:00', '1970-01-13 18:00',
5044+
'1970-01-14 06:00', '1970-01-14 07:00', '1970-01-14 08:00', '1970-01-14 09:00', '1970-01-14 10:00', '1970-01-14 11:00', '1970-01-14 12:00', '1970-01-14 13:00', '1970-01-14 14:00', '1970-01-14 15:00', '1970-01-14 16:00', '1970-01-14 17:00', '1970-01-14 18:00'
5045+
]
5046+
}],
5047+
layout: {
5048+
width: 1600,
5049+
height: 1600
5050+
}
5051+
};
5052+
5053+
fig.layout.xaxis = {
5054+
autorange: autorange,
5055+
tick0: '1970-01-01 08:00',
5056+
dtick: 4 * 60 * 60 * 1000,
5057+
rangebreaks: [{
5058+
bounds: [ 17, 8 ],
5059+
pattern: 'hour'
5060+
}, {
5061+
bounds: [ 6, 1 ],
5062+
pattern: 'day of week'
5063+
}]
5064+
};
5065+
5066+
Plotly.newPlot(gd, fig)
5067+
.then(function() {
5068+
_assert('base', {
5069+
tickVals: [
5070+
'1970-01-01 08:00',
5071+
'1970-01-01 12:00', '1970-01-01 16:00',
5072+
'1970-01-02 12:00', '1970-01-02 16:00',
5073+
'1970-01-05 12:00', '1970-01-05 16:00',
5074+
'1970-01-06 12:00', '1970-01-06 16:00',
5075+
'1970-01-07 12:00', '1970-01-07 16:00',
5076+
'1970-01-08 12:00', '1970-01-08 16:00',
5077+
'1970-01-09 12:00', '1970-01-09 16:00',
5078+
'1970-01-12 12:00', '1970-01-12 16:00',
5079+
'1970-01-13 12:00', '1970-01-13 16:00',
5080+
'1970-01-14 12:00', '1970-01-14 16:00'
5081+
].map(Lib.dateTime2ms)
5082+
});
5083+
})
5084+
.then(function() {
5085+
fig.layout.xaxis = {
5086+
autorange: autorange,
5087+
tick0: '1970-01-01 08:00',
5088+
dtick: 3 * 60 * 60 * 1000,
5089+
rangebreaks: [{
5090+
bounds: [ 17, 8 ],
5091+
pattern: 'hour'
5092+
}, {
5093+
bounds: [ 6, 1 ],
5094+
pattern: 'day of week'
5095+
}]
5096+
};
5097+
return Plotly.newPlot(gd, gd.data, gd.layout);
5098+
})
5099+
.then(function() {
5100+
_assert('3-hour dtick', {
5101+
tickVals: [
5102+
'1970-01-01 08:00', '1970-01-01 11:00', '1970-01-01 14:00',
5103+
'1970-01-02 08:00', '1970-01-02 11:00', '1970-01-02 14:00',
5104+
'1970-01-05 08:00', '1970-01-05 11:00', '1970-01-05 14:00',
5105+
'1970-01-06 08:00', '1970-01-06 11:00', '1970-01-06 14:00',
5106+
'1970-01-07 08:00', '1970-01-07 11:00', '1970-01-07 14:00',
5107+
'1970-01-08 08:00', '1970-01-08 11:00', '1970-01-08 14:00',
5108+
'1970-01-09 08:00', '1970-01-09 11:00', '1970-01-09 14:00',
5109+
'1970-01-12 08:00', '1970-01-12 11:00', '1970-01-12 14:00',
5110+
'1970-01-13 08:00', '1970-01-13 11:00', '1970-01-13 14:00',
5111+
'1970-01-14 08:00', '1970-01-14 11:00', '1970-01-14 14:00'
5112+
].map(Lib.dateTime2ms)
5113+
});
5114+
})
5115+
.then(function() {
5116+
fig.layout.xaxis = {
5117+
autorange: autorange,
5118+
tick0: '1970-01-01 08:00',
5119+
dtick: 2 * 60 * 60 * 1000,
5120+
rangebreaks: [{
5121+
bounds: [ 17, 8 ],
5122+
pattern: 'hour'
5123+
}, {
5124+
bounds: [ 6, 1 ],
5125+
pattern: 'day of week'
5126+
}]
5127+
};
5128+
return Plotly.newPlot(gd, gd.data, gd.layout);
5129+
})
5130+
.then(function() {
5131+
_assert('2-hour dtick', {
5132+
tickVals: [
5133+
'1970-01-01 08:00',
5134+
'1970-01-01 10:00', '1970-01-01 12:00', '1970-01-01 14:00', '1970-01-01 16:00',
5135+
'1970-01-02 10:00', '1970-01-02 12:00', '1970-01-02 14:00', '1970-01-02 16:00',
5136+
'1970-01-05 10:00', '1970-01-05 12:00', '1970-01-05 14:00', '1970-01-05 16:00',
5137+
'1970-01-06 10:00', '1970-01-06 12:00', '1970-01-06 14:00', '1970-01-06 16:00',
5138+
'1970-01-07 10:00', '1970-01-07 12:00', '1970-01-07 14:00', '1970-01-07 16:00',
5139+
'1970-01-08 10:00', '1970-01-08 12:00', '1970-01-08 14:00', '1970-01-08 16:00',
5140+
'1970-01-09 10:00', '1970-01-09 12:00', '1970-01-09 14:00', '1970-01-09 16:00',
5141+
'1970-01-12 10:00', '1970-01-12 12:00', '1970-01-12 14:00', '1970-01-12 16:00',
5142+
'1970-01-13 10:00', '1970-01-13 12:00', '1970-01-13 14:00', '1970-01-13 16:00',
5143+
'1970-01-14 10:00', '1970-01-14 12:00', '1970-01-14 14:00', '1970-01-14 16:00'
5144+
].map(Lib.dateTime2ms)
5145+
});
5146+
})
5147+
.catch(failTest)
5148+
.then(done);
5149+
});
5150+
});
50255151
});
50265152

50275153
it('should set visible:false in scattergl traces on axis with rangebreaks', function(done) {

0 commit comments

Comments
 (0)