Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2576,7 +2576,7 @@ plots.doSetPositions = function(gd) {

for(j = 0; j < modules.length; j++) {
var _module = modules[j];
var fn = _module.setPositions;
var fn = _module.crossTraceCalc;
if(fn) {
var spType = _module.basePlotModule.name;
if(hash[spType]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Sieve = require('./sieve.js');
* now doing this one subplot at a time
*/

module.exports = function setPositions(gd, plotinfo) {
module.exports = function crossTraceCalc(gd, plotinfo) {
var xa = plotinfo.xaxis,
ya = plotinfo.yaxis;

Expand Down
2 changes: 1 addition & 1 deletion src/traces/bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Bar.layoutAttributes = require('./layout_attributes');
Bar.supplyDefaults = require('./defaults');
Bar.supplyLayoutDefaults = require('./layout_defaults');
Bar.calc = require('./calc');
Bar.setPositions = require('./set_positions');
Bar.crossTraceCalc = require('./cross_trace_calc');
Bar.colorbar = require('../scatter/marker_colorbar');
Bar.arraysToCalcdata = require('./arrays_to_calcdata');
Bar.plot = require('./plot');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Lib = require('../../lib');

var orientations = ['v', 'h'];

function setPositions(gd, plotinfo) {
function crossTraceCalc(gd, plotinfo) {
var calcdata = gd.calcdata;
var xa = plotinfo.xaxis;
var ya = plotinfo.yaxis;
Expand Down Expand Up @@ -109,6 +109,6 @@ function setPositionOffset(traceType, gd, boxList, posAxis, pad) {
}

module.exports = {
setPositions: setPositions,
crossTraceCalc: crossTraceCalc,
setPositionOffset: setPositionOffset
};
2 changes: 1 addition & 1 deletion src/traces/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Box.layoutAttributes = require('./layout_attributes');
Box.supplyDefaults = require('./defaults').supplyDefaults;
Box.supplyLayoutDefaults = require('./layout_defaults').supplyLayoutDefaults;
Box.calc = require('./calc');
Box.setPositions = require('./set_positions').setPositions;
Box.crossTraceCalc = require('./cross_trace_calc').crossTraceCalc;
Box.plot = require('./plot').plot;
Box.style = require('./style').style;
Box.styleOnSelect = require('./style').styleOnSelect;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/candlestick/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
attributes: require('./attributes'),
layoutAttributes: require('../box/layout_attributes'),
supplyLayoutDefaults: require('../box/layout_defaults').supplyLayoutDefaults,
setPositions: require('../box/set_positions').setPositions,
crossTraceCalc: require('../box/cross_trace_calc').crossTraceCalc,
supplyDefaults: require('./defaults'),
calc: require('./calc'),
plot: require('../box/plot').plot,
Expand Down
4 changes: 2 additions & 2 deletions src/traces/histogram/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Histogram has its own attribute, defaults and calc steps,
* but uses bar's plot to display
* and bar's setPositions for stacking and grouping
* and bar's crossTraceCalc (formally known as setPositions) for stacking and grouping
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formally formerly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in -> e236038

*/

/**
Expand All @@ -30,7 +30,7 @@ Histogram.layoutAttributes = require('../bar/layout_attributes');
Histogram.supplyDefaults = require('./defaults');
Histogram.supplyLayoutDefaults = require('../bar/layout_defaults');
Histogram.calc = require('./calc');
Histogram.setPositions = require('../bar/set_positions');
Histogram.crossTraceCalc = require('../bar/cross_trace_calc');
Histogram.plot = require('../bar/plot');
Histogram.layerName = 'barlayer';
Histogram.style = require('../bar/style').style;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

'use strict';

var setPositionOffset = require('../box/set_positions').setPositionOffset;
var setPositionOffset = require('../box/cross_trace_calc').setPositionOffset;
var orientations = ['v', 'h'];

module.exports = function setPositions(gd, plotinfo) {
module.exports = function crossTraceCalc(gd, plotinfo) {
var calcdata = gd.calcdata;
var xa = plotinfo.xaxis;
var ya = plotinfo.yaxis;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/violin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
supplyDefaults: require('./defaults'),
supplyLayoutDefaults: require('./layout_defaults'),
calc: require('./calc'),
setPositions: require('./set_positions'),
crossTraceCalc: require('./cross_trace_calc'),
plot: require('./plot'),
style: require('./style'),
styleOnSelect: require('../scatter/style').styleOnSelect,
Expand Down
18 changes: 9 additions & 9 deletions test/jasmine/tests/bar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('Bar.supplyDefaults', function() {
});
});

describe('bar calc / setPositions', function() {
describe('bar calc / crossTraceCalc (formally known as setPositions)', function() {
'use strict';

it('should fill in calc pt fields (stack case)', function() {
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('Bar.calc', function() {
});
});

describe('Bar.setPositions', function() {
describe('Bar.crossTraceCalc (formally known as setPositions)', function() {
'use strict';

it('should guard against invalid offset items', function() {
Expand Down Expand Up @@ -1347,9 +1347,9 @@ describe('bar visibility toggling:', function() {
expect(fullLayout.xaxis.range).toBeCloseToArray(xrng, 2, msg + ' xrng');
expect(fullLayout.yaxis.range).toBeCloseToArray(yrng, 2, msg + ' yrng');

var setPositions = gd._fullData[0]._module.setPositions;
expect(setPositions).toHaveBeenCalledTimes(calls);
setPositions.calls.reset();
var crossTraceCalc = gd._fullData[0]._module.crossTraceCalc;
expect(crossTraceCalc).toHaveBeenCalledTimes(calls);
crossTraceCalc.calls.reset();
}

it('should update axis range according to visible edits (group case)', function(done) {
Expand All @@ -1358,7 +1358,7 @@ describe('bar visibility toggling:', function() {
{type: 'bar', x: [1, 2, 3], y: [-1, -2, -1]}
])
.then(function() {
spyOn(gd._fullData[0]._module, 'setPositions').and.callThrough();
spyOn(gd._fullData[0]._module, 'crossTraceCalc').and.callThrough();

_assert('base', [0.5, 3.5], [-2.222, 2.222], 0);
return Plotly.restyle(gd, 'visible', false, [1]);
Expand Down Expand Up @@ -1388,7 +1388,7 @@ describe('bar visibility toggling:', function() {
{type: 'bar', x: [1, 2, 3], y: [2, 3, 2]}
], {barmode: 'stack'})
.then(function() {
spyOn(gd._fullData[0]._module, 'setPositions').and.callThrough();
spyOn(gd._fullData[0]._module, 'crossTraceCalc').and.callThrough();

_assert('base', [0.5, 3.5], [0, 5.263], 0);
return Plotly.restyle(gd, 'visible', false, [1]);
Expand Down Expand Up @@ -1806,8 +1806,8 @@ function mockBarPlot(dataWithoutTraceType, layout) {
yaxis: gd._fullLayout.yaxis
};

// call Bar.setPositions
Bar.setPositions(gd, plotinfo);
// call Bar.crossTraceCalc
Bar.crossTraceCalc(gd, plotinfo);

return gd;
}
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/finance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ describe('finance charts calc', function() {
supplyAllDefaults(gd);
Plots.doCalcdata(gd);
gd.calcdata.forEach(function(cd) {
// fill in some stuff that happens during setPositions or plot
// fill in some stuff that happens during crossTraceCalc or plot
if(cd[0].trace.type === 'candlestick') {
var diff = cd[1].pos - cd[0].pos;
cd[0].t.wHover = diff / 2;
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/histogram_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe('Test histogram', function() {
var d73 = Date.UTC(1973, 0, 1);
expect(out).toEqual([
// full calcdata has x and y too (and t in the first one),
// but those come later from setPositions.
// but those come later from crossTraceCalc.
{i: 0, b: 0, p: d70, s: 2, pts: [0, 1], p0: d70, p1: d70},
{i: 1, b: 0, p: d71, s: 1, pts: [2], p0: d71, p1: d71},
{i: 2, b: 0, p: d72, s: 0, pts: [], p0: d72, p1: d72},
Expand Down