Skip to content

Commit c10c734

Browse files
committed
remove rangebreak operation attribute
1 parent 99d8bde commit c10c734

File tree

3 files changed

+6
-50
lines changed

3 files changed

+6
-50
lines changed

src/plots/cartesian/axis_defaults.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ var handleCategoryOrderDefaults = require('./category_order_defaults');
2121
var handleLineGridDefaults = require('./line_grid_defaults');
2222
var setConvert = require('./set_convert');
2323

24-
var constants = require('./constants');
25-
var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN;
26-
2724
/**
2825
* options: object containing:
2926
*
@@ -159,8 +156,6 @@ function rangebreaksDefaults(itemIn, itemOut, containerOut) {
159156
if(enabled) {
160157
var bnds = coerce('bounds');
161158

162-
var pattern;
163-
164159
if(bnds && bnds.length >= 2) {
165160
if(bnds.length > 2) {
166161
itemOut.bounds = itemOut.bounds.slice(0, 2);
@@ -181,7 +176,7 @@ function rangebreaksDefaults(itemIn, itemOut, containerOut) {
181176
}
182177
}
183178

184-
pattern = coerce('pattern');
179+
coerce('pattern');
185180
} else {
186181
var values = coerce('values');
187182

@@ -192,9 +187,5 @@ function rangebreaksDefaults(itemIn, itemOut, containerOut) {
192187
return;
193188
}
194189
}
195-
196-
if(pattern !== WEEKDAY_PATTERN) {
197-
coerce('operation');
198-
}
199190
}
200191
}

src/plots/cartesian/layout_attributes.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ module.exports = {
273273
editType: 'calc',
274274
description: [
275275
'Sets the lower and upper bounds of this axis rangebreak.',
276-
'Can be used with `operation` to determine the behavior at the bounds.',
277276
'Can be used with `pattern`.'
278277
].join(' ')
279278
},
@@ -292,7 +291,7 @@ module.exports = {
292291
'Examples:',
293292
'- { pattern: \'' + DAY_OF_WEEK + '\', bounds: [6, 0] }',
294293
' breaks from Saturday to Monday (i.e. skips the weekends).',
295-
'- { pattern: \'' + HOUR + '\', bounds: [17, 8], operation: \'()\' }', // TODO: simplify after revise defaults
294+
'- { pattern: \'' + HOUR + '\', bounds: [17, 8] }',
296295
' breaks from 5pm to 8am (i.e. skips non-work hours).'
297296
].join(' ')
298297
},
@@ -325,23 +324,6 @@ module.exports = {
325324
].join(' ')
326325
},
327326

328-
operation: {
329-
valType: 'enumerated',
330-
values: ['[]', '()', '[)', '(]'],
331-
dflt: '[)',
332-
role: 'info',
333-
editType: 'calc',
334-
description: [
335-
'Determines if we include or not the bound values within the rangebreak.',
336-
'Closed interval bounds (i.e. starting with *[* or ending with *]*)',
337-
'include the bound value within the rangebreak and thus make coordinates',
338-
'equal to the bound disappear.',
339-
'Open interval bounds (i.e. starting with *(* or ending with *)*)',
340-
'does not include the bound value within the rangebreak and thus keep coordinates',
341-
'equal to the bound on the axis.'
342-
].join(' ')
343-
},
344-
345327
/*
346328
gap: {
347329
valType: 'number',

src/plots/cartesian/set_convert.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,6 @@ module.exports = function setConvert(ax, fullLayout) {
620620
var brk = rangebreaksIn[i];
621621

622622
if(brk.enabled) {
623-
var op = brk.operation || '[)';
624-
var op0 = op.charAt(0);
625-
var op1 = op.charAt(1);
626-
627623
if(brk.bounds) {
628624
var pattern = brk.pattern;
629625
bnds = Lib.simpleMap(brk.bounds, pattern ?
@@ -671,24 +667,17 @@ module.exports = function setConvert(ax, fullLayout) {
671667
break;
672668
}
673669

674-
if(
675-
(op0 === '(' ? vb > b0 : vb >= b0) &&
676-
(op1 === ')' ? vb < b1 : vb <= b1)
677-
) return BADNUM;
670+
if(vb >= b0 && vb < b1) return BADNUM;
678671
} else {
679672
var vals = Lib.simpleMap(brk.values, ax.d2c).sort(Lib.sorterAsc);
680673
var onOpenBound = false;
681674

682675
for(var j = 0; j < vals.length; j++) {
683676
b0 = vals[j];
684677
b1 = b0 + brk.dvalue;
685-
if(
686-
(op0 === '(' ? v > b0 : v >= b0) &&
687-
(op1 === ')' ? v < b1 : v <= b1)
688-
) return BADNUM;
678+
if(v >= b0 && v < b1) return BADNUM;
689679

690-
if(onOpenBound && op0 === '(' && v === b0) return BADNUM;
691-
onOpenBound = op1 === ')' && v === b1;
680+
if(onOpenBound && v === b0) return BADNUM;
692681
}
693682
}
694683
}
@@ -737,14 +726,9 @@ module.exports = function setConvert(ax, fullLayout) {
737726
var brk = rangebreaksIn[i];
738727

739728
if(brk.enabled) {
740-
var op = brk.operation || '[)';
741-
var op0 = op.charAt(0);
742-
var op1 = op.charAt(1);
743-
744729
if(brk.bounds) {
745730
if(brk.pattern) {
746731
bnds = Lib.simpleMap(brk.bounds, cleanNumber);
747-
if(bnds[0] === bnds[1] && op === '()') continue;
748732

749733
// r0 value as date
750734
var r0Date = new Date(r0);
@@ -761,12 +745,11 @@ module.exports = function setConvert(ax, fullLayout) {
761745

762746
switch(brk.pattern) {
763747
case WEEKDAY_PATTERN:
764-
b0 = bnds[0] + (op0 === '(' ? 1 : 0);
748+
b0 = bnds[0];
765749
b1 = bnds[1];
766750
r0Pattern = r0Date.getUTCDay();
767751
r0PatternDelta = b0 - r0Pattern;
768752
bndDelta = (b1 >= b0 ? b1 - b0 : (b1 + 7) - b0) * ONEDAY;
769-
if(op1 === ']') bndDelta += ONEDAY;
770753
step = 7 * ONEDAY;
771754

772755
t = r0 + r0PatternDelta * ONEDAY -

0 commit comments

Comments
 (0)