Skip to content

Commit d82db2e

Browse files
committed
replace rangebrekas.pattern (time of day) with (hour)
1 parent 0bf5ceb commit d82db2e

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

src/plots/cartesian/layout_attributes.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,21 @@ module.exports = {
279279
pattern: {
280280
valType: 'enumerated',
281281
// TODO could add '%H:%M:%S'
282-
values: ['day of week', 'time of day', ''],
282+
values: ['day of week', 'hour', ''],
283283
dflt: '',
284284
role: 'info',
285285
editType: 'calc',
286286
description: [
287287
'Determines a pattern on the time line that generates breaks.',
288288
'If *day of week* - Sunday-based weekday as a decimal number [0, 6].',
289-
'If *time of day* - hour (24-hour clock) as a decimal number [0, 23].',
290-
'*day of week* and *time of day* are similar to *%w* and *%H* directives',
289+
'If *hour* - hour (24-hour clock) as a decimal number [0, 23].',
290+
'*day of week* and *hour* are similar to *%w* and *%H* directives',
291291
'applied in `tickformat`, see https://github.com/d3/d3-time-format#locale_format',
292292
'for more info.',
293293
'Examples:',
294294
'- { pattern: \'day of week\', bounds: [6, 0] }',
295295
' breaks from Saturday to Monday (i.e. skips the weekends).',
296-
'- { pattern: \'time of day\', bounds: [16, 8] }',
296+
'- { pattern: \'hour\', bounds: [16, 8] }',
297297
' breaks from 4pm to 8am (i.e. skips non-work hours).'
298298
].join(' ')
299299
},

src/plots/cartesian/set_convert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ module.exports = function setConvert(ax, fullLayout) {
632632
vb = (new Date(v)).getUTCDay();
633633
if(bnds[0] > bnds[1]) doesCrossPeriod = true;
634634
break;
635-
case 'time of day':
635+
case 'hour':
636636
bnds = Lib.simpleMap(brk.bounds, cleanNumber);
637637
b0 = bnds[0];
638638
b1 = bnds[1];
@@ -699,8 +699,8 @@ module.exports = function setConvert(ax, fullLayout) {
699699
if(!ax.rangebreaks) return rangebreaksOut;
700700

701701
var rangebreaksIn = ax.rangebreaks.slice().sort(function(a, b) {
702-
if(a.pattern === 'day of week' && b.pattern === 'time of day') return -1;
703-
else if(b.pattern === 'day of week' && a.pattern === 'time of day') return 1;
702+
if(a.pattern === 'day of week' && b.pattern === 'hour') return -1;
703+
else if(b.pattern === 'day of week' && a.pattern === 'hour') return 1;
704704
return 0;
705705
});
706706

@@ -771,7 +771,7 @@ module.exports = function setConvert(ax, fullLayout) {
771771
r0Date.getUTCSeconds() * ONESEC -
772772
r0Date.getUTCMilliseconds();
773773
break;
774-
case 'time of day':
774+
case 'hour':
775775
b0 = bnds[0];
776776
b1 = bnds[1];
777777
r0Pattern = r0Date.getUTCHours();

test/image/mocks/axes_breaks-night_autorange-reversed.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
"xaxis": {
193193
"rangebreaks": [
194194
{
195-
"pattern": "time of day",
195+
"pattern": "hour",
196196
"bounds": [
197197
18,
198198
6
@@ -208,7 +208,7 @@
208208
"xaxis2": {
209209
"rangebreaks": [
210210
{
211-
"pattern": "time of day",
211+
"pattern": "hour",
212212
"bounds": [
213213
18,
214214
6
@@ -253,7 +253,7 @@
253253
"yaxis3": {
254254
"rangebreaks": [
255255
{
256-
"pattern": "time of day",
256+
"pattern": "hour",
257257
"bounds": [
258258
18,
259259
6
@@ -270,7 +270,7 @@
270270
"yaxis4": {
271271
"rangebreaks": [
272272
{
273-
"pattern": "time of day",
273+
"pattern": "hour",
274274
"bounds": [
275275
18,
276276
6

test/image/mocks/axes_breaks-rangeslider.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2659,17 +2659,17 @@
26592659
"operation": "[]"
26602660
},
26612661
{
2662-
"pattern": "time of day",
2662+
"pattern": "hour",
26632663
"bounds": [0, 9],
26642664
"operation": "()"
26652665
},
26662666
{
2667-
"pattern": "time of day",
2667+
"pattern": "hour",
26682668
"bounds": [12, 13],
26692669
"operation": "()"
26702670
},
26712671
{
2672-
"pattern": "time of day",
2672+
"pattern": "hour",
26732673
"bounds": [15, 21],
26742674
"operation": "()"
26752675
}

test/image/mocks/axes_breaks-weekends-weeknights.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"operation": "[]"
2121
},
2222
{
23-
"pattern": "time of day",
23+
"pattern": "hour",
2424
"bounds": [ 16, 8 ],
2525
"operation": "()"
2626
}

test/jasmine/tests/axes_test.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -4166,7 +4166,7 @@ describe('Test axes', function() {
41664166
_assert('(5,0]', noWeekend);
41674167
});
41684168

4169-
it('should discard coords within break bounds - date time of day case', function() {
4169+
it('should discard coords within break bounds - date hour case', function() {
41704170
_calc({
41714171
x: [
41724172
'2020-01-02 08:00', '2020-01-02 20:00',
@@ -4179,7 +4179,7 @@ describe('Test axes', function() {
41794179
}, {
41804180
xaxis: {
41814181
rangebreaks: [
4182-
{pattern: 'time of day', bounds: [17, 8], operation: '()'}
4182+
{pattern: 'hour', bounds: [17, 8], operation: '()'}
41834183
]
41844184
}
41854185
});
@@ -4193,7 +4193,7 @@ describe('Test axes', function() {
41934193
]);
41944194
});
41954195

4196-
it('should discard coords within break bounds - date time of day / high precision case', function() {
4196+
it('should discard coords within break bounds - date hour / high precision case', function() {
41974197
_calc({
41984198
x: [
41994199
'2020-01-03 17:00',
@@ -4207,7 +4207,7 @@ describe('Test axes', function() {
42074207
}, {
42084208
xaxis: {
42094209
rangebreaks: [
4210-
{pattern: 'time of day', bounds: [17, 8], operation: '()'}
4210+
{pattern: 'hour', bounds: [17, 8], operation: '()'}
42114211
]
42124212
}
42134213
});
@@ -4680,7 +4680,7 @@ describe('Test axes', function() {
46804680
})
46814681
.then(function() {
46824682
gd.layout.xaxis.rangebreaks = [
4683-
{pattern: 'time of day', bounds: [17, 8], operation: '()'}
4683+
{pattern: 'hour', bounds: [17, 8], operation: '()'}
46844684
];
46854685
return Plotly.react(gd, gd.data, gd.layout);
46864686
})
@@ -4706,7 +4706,7 @@ describe('Test axes', function() {
47064706
.then(function() {
47074707
gd.layout.xaxis.rangebreaks = [
47084708
{pattern: 'day of week', bounds: [5, 1], operation: '()'},
4709-
{pattern: 'time of day', bounds: [17, 8], operation: '()'}
4709+
{pattern: 'hour', bounds: [17, 8], operation: '()'}
47104710
];
47114711
return Plotly.react(gd, gd.data, gd.layout);
47124712
})
@@ -4728,7 +4728,7 @@ describe('Test axes', function() {
47284728
})
47294729
.then(function() {
47304730
gd.layout.xaxis.rangebreaks = [
4731-
{pattern: 'time of day', bounds: [17, 8], operation: '()'},
4731+
{pattern: 'hour', bounds: [17, 8], operation: '()'},
47324732
{pattern: 'day of week', bounds: [5, 1], operation: '()'}
47334733
];
47344734
return Plotly.react(gd, gd.data, gd.layout);
@@ -4751,15 +4751,15 @@ describe('Test axes', function() {
47514751
})
47524752
.then(function() {
47534753
gd.layout.xaxis.rangebreaks = [
4754-
{pattern: 'time of day', bounds: [17, 8], operation: '()'}
4754+
{pattern: 'hour', bounds: [17, 8], operation: '()'}
47554755
];
47564756
// N.B. xaxis.range[0] falls within a break
47574757
gd.layout.xaxis.autorange = false;
47584758
gd.layout.xaxis.range = ['2020-01-01 20:00:00', '2020-01-04 20:00:00'];
47594759
return Plotly.react(gd, gd.data, gd.layout);
47604760
})
47614761
.then(function() {
4762-
_assert('when range[0] falls within a break pattern (time of day case)', 'x', {
4762+
_assert('when range[0] falls within a break pattern (hour case)', 'x', {
47634763
rangebreaks: [
47644764
[1577908800000, Lib.dateTime2ms('2020-01-02 08:00:00')],
47654765
['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms),
@@ -4917,7 +4917,7 @@ describe('Test axes', function() {
49174917
]
49184918
}], {
49194919
xaxis: {
4920-
rangebreaks: [{pattern: 'time of day', bounds: [17, 8]}]
4920+
rangebreaks: [{pattern: 'hour', bounds: [17, 8]}]
49214921
}
49224922
})
49234923
.then(function() {

0 commit comments

Comments
 (0)