Skip to content

Commit

Permalink
Merge pull request #4641 from plotly/rename-breaks-to-rangebreaks
Browse files Browse the repository at this point in the history
rename axis.breaks to axis.rangebreaks
  • Loading branch information
archmoj committed Mar 14, 2020
2 parents add15b1 + cc49b99 commit dff40cc
Show file tree
Hide file tree
Showing 20 changed files with 242 additions and 242 deletions.
12 changes: 6 additions & 6 deletions src/components/rangeslider/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module.exports = function(gd) {
return (v - rl0) / drl * opts._width;
};

if(axisOpts.breaks) {
if(axisOpts.rangebreaks) {
var rsBreaks = axisOpts.locateBreaks(rl0, rl1);

if(rsBreaks.length) {
Expand Down Expand Up @@ -169,7 +169,7 @@ module.exports = function(gd) {
};

// fill pixel (i.e. 'p') min/max here,
// to not have to loop through the _breaks twice during `p2d`
// to not have to loop through the _rangebreaks twice during `p2d`
for(j = 0; j < rsBreaks.length; j++) {
brk = rsBreaks[j];
brk.pmin = opts.d2p(brk.min);
Expand Down Expand Up @@ -455,8 +455,8 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) {
_context: gd._context
};

if(axisOpts.breaks) {
mockFigure.layout.xaxis.breaks = axisOpts.breaks;
if(axisOpts.rangebreaks) {
mockFigure.layout.xaxis.rangebreaks = axisOpts.rangebreaks;
}

mockFigure.layout[oppAxisName] = {
Expand All @@ -466,8 +466,8 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) {
calendar: oppAxisOpts.calendar
};

if(oppAxisOpts.breaks) {
mockFigure.layout[oppAxisName].breaks = oppAxisOpts.breaks;
if(oppAxisOpts.rangebreaks) {
mockFigure.layout[oppAxisName].rangebreaks = oppAxisOpts.rangebreaks;
}

Plots.supplyDefaults(mockFigure);
Expand Down
10 changes: 5 additions & 5 deletions src/plots/cartesian/autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ function getAutoRange(gd, ax) {
// don't allow padding to reduce the data to < 10% of the length
var minSpan = axLen / 10;

// find axis breaks in [v0,v1] and compute its length in value space
// find axis rangebreaks in [v0,v1] and compute its length in value space
var calcBreaksLength = function(v0, v1) {
var lBreaks = 0;
if(ax.breaks) {
var breaksOut = ax.locateBreaks(v0, v1);
for(var i = 0; i < breaksOut.length; i++) {
var brk = breaksOut[i];
if(ax.rangebreaks) {
var rangebreaksOut = ax.locateBreaks(v0, v1);
for(var i = 0; i < rangebreaksOut.length; i++) {
var brk = rangebreaksOut[i];
lBreaks += brk.max - brk.min;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,17 +610,17 @@ axes.calcTicks = function calcTicks(ax) {

generateTicks();

if(ax.breaks) {
if(ax.rangebreaks) {
var nTicksBefore = tickVals.length;

// remove ticks falling inside breaks
// remove ticks falling inside rangebreaks
tickVals = tickVals.filter(function(d) {
return ax.maskBreaks(d.value) !== BADNUM;
});

// if 'numerous' ticks get placed into breaks,
// if 'numerous' ticks get placed into rangebreaks,
// increase dtick to generate more ticks,
// so that some hopefully fall between breaks
// so that some hopefully fall between rangebreaks
if(ax.tickmode === 'auto' && tickVals.length < nTicksBefore / 6) {
axes.autoTicks(ax, ax._roughDTick / 3);
autoTickRound(ax);
Expand Down Expand Up @@ -706,8 +706,8 @@ function arrayTicks(ax) {

if(j < vals.length) ticksOut.splice(j, vals.length - j);

if(ax.breaks) {
// remove ticks falling inside breaks
if(ax.rangebreaks) {
// remove ticks falling inside rangebreaks
ticksOut = ticksOut.filter(function(d) {
return ax.maskBreaks(d.x) !== BADNUM;
});
Expand Down Expand Up @@ -2871,7 +2871,7 @@ axes.shouldShowZeroLine = function(gd, ax, counterAxis) {
(rng[0] * rng[1] <= 0) &&
ax.zeroline &&
(ax.type === 'linear' || ax.type === '-') &&
!(ax.breaks && ax.maskBreaks(0) === BADNUM) &&
!(ax.rangebreaks && ax.maskBreaks(0) === BADNUM) &&
(
clipEnds(ax, 0) ||
!anyCounterAxLineAtZero(gd, ax, counterAxis, rng) ||
Expand Down
14 changes: 7 additions & 7 deletions src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
}

if(containerOut.type === 'date') {
var breaks = containerIn.breaks;
if(Array.isArray(breaks) && breaks.length) {
var rangebreaks = containerIn.rangebreaks;
if(Array.isArray(rangebreaks) && rangebreaks.length) {
handleArrayContainerDefaults(containerIn, containerOut, {
name: 'breaks',
name: 'rangebreaks',
inclusionAttr: 'enabled',
handleItemDefaults: breaksDefaults
handleItemDefaults: rangebreaksDefaults
});
setConvert(containerOut, layoutOut);

Expand All @@ -135,7 +135,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
if(trace.type === 'scattergl' || trace.type === 'splom') {
trace.visible = false;
Lib.warn(trace.type +
' traces do not work on axes with breaks.' +
' traces do not work on axes with rangebreaks.' +
' Setting trace ' + trace.index + ' to `visible: false`.');
}
}
Expand All @@ -146,9 +146,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
return containerOut;
};

function breaksDefaults(itemIn, itemOut, containerOut) {
function rangebreaksDefaults(itemIn, itemOut, containerOut) {
function coerce(attr, dflt) {
return Lib.coerce(itemIn, itemOut, layoutAttributes.breaks, attr, dflt);
return Lib.coerce(itemIn, itemOut, layoutAttributes.rangebreaks, attr, dflt);
}

var enabled = coerce('enabled');
Expand Down
4 changes: 2 additions & 2 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) {
var axi = axList[i];
if(axi.fixedrange) continue;

if(axi.breaks) {
if(axi.rangebreaks) {
var isY = axi._id.charAt(0) === 'y';
var r0F = isY ? (1 - r0Fraction) : r0Fraction;
var r1F = isY ? (1 - r1Fraction) : r1Fraction;
Expand All @@ -1012,7 +1012,7 @@ function dragAxList(axList, pix) {
for(var i = 0; i < axList.length; i++) {
var axi = axList[i];
if(!axi.fixedrange) {
if(axi.breaks) {
if(axi.rangebreaks) {
var p0 = 0;
var p1 = axi._length;
var d0 = axi.p2l(p0 + pix) - axi.p2l(p0);
Expand Down
18 changes: 9 additions & 9 deletions src/plots/cartesian/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ module.exports = {
].join(' ')
},

breaks: templatedArray('break', {
rangebreaks: templatedArray('rangebreak', {
enabled: {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc',
description: [
'Determines whether this axis break is enabled or disabled.',
'Please note that `breaks` only work for *date* axis type.'
'Determines whether this axis rangebreak is enabled or disabled.',
'Please note that `rangebreaks` only work for *date* axis type.'
].join(' ')
},

Expand All @@ -270,7 +270,7 @@ module.exports = {
],
editType: 'calc',
description: [
'Sets the lower and upper bounds of this axis break.',
'Sets the lower and upper bounds of this axis rangebreak.',
'Can be used with `operation` to determine the behavior at the bounds.',
'Can be used with `pattern`.'
].join(' ')
Expand Down Expand Up @@ -308,7 +308,7 @@ module.exports = {
editType: 'calc'
},
description: [
'Sets the coordinate values corresponding to the breaks.',
'Sets the coordinate values corresponding to the rangebreaks.',
'An alternative to `bounds`.',
'Use `dvalue` to set the size of the values along the axis.'
].join(' ')
Expand All @@ -333,12 +333,12 @@ module.exports = {
role: 'info',
editType: 'calc',
description: [
'Determines if we include or not the bound values within the break.',
'Determines if we include or not the bound values within the rangebreak.',
'Closed interval bounds (i.e. starting with *[* or ending with *]*)',
'include the bound value within the break and thus make coordinates',
'include the bound value within the rangebreak and thus make coordinates',
'equal to the bound disappear.',
'Open interval bounds (i.e. starting with *(* or ending with *)*)',
'does not include the bound value within the break and thus keep coordinates',
'does not include the bound value within the rangebreak and thus keep coordinates',
'equal to the bound on the axis.'
].join(' ')
},
Expand All @@ -351,7 +351,7 @@ module.exports = {
editType: 'calc',
role: 'info',
description: [
'Sets the gap distance between the start and the end of this break.',
'Sets the gap distance between the start and the end of this rangebreak.',
'Use with `gapmode` to set the unit of measurement.'
].join(' ')
},
Expand Down
Loading

0 comments on commit dff40cc

Please sign in to comment.