Skip to content

Commit 8e3a0ba

Browse files
committed
make Plots.generalUpdatePerTraceModule consistent w/ Cartesian.plot
... by making 'gd' the first argument, some subplot object the 2nd and the module calcdata the 3rd.
1 parent ac7db75 commit 8e3a0ba

File tree

10 files changed

+22
-29
lines changed

10 files changed

+22
-29
lines changed

src/plots/geo/geo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ proto.update = function(geoCalcData, fullLayout) {
140140
this.updateDims(fullLayout, geoLayout);
141141
this.updateFx(fullLayout, geoLayout);
142142

143-
Plots.generalUpdatePerTraceModule(this, geoCalcData, geoLayout);
143+
Plots.generalUpdatePerTraceModule(this.graphDiv, this, geoCalcData, geoLayout);
144144

145145
var scatterLayer = this.layers.frontplot.select('.scatterlayer');
146146
this.dataPoints.point = scatterLayer.selectAll('.point');

src/plots/plots.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,10 +2428,10 @@ plots.rehover = function(gd) {
24282428
}
24292429
};
24302430

2431-
plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLayout) {
2432-
var traceHashOld = subplot.traceHash,
2433-
traceHash = {},
2434-
i;
2431+
plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
2432+
var traceHashOld = subplot.traceHash;
2433+
var traceHash = {};
2434+
var i;
24352435

24362436
// build up moduleName -> calcData hash
24372437
for(i = 0; i < subplotCalcData.length; i++) {
@@ -2450,7 +2450,6 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa
24502450
// plot method is called so that it is properly
24512451
// removed from the DOM.
24522452
for(var moduleNameOld in traceHashOld) {
2453-
24542453
if(!traceHash[moduleNameOld]) {
24552454
var fakeCalcTrace = traceHashOld[moduleNameOld][0],
24562455
fakeTrace = fakeCalcTrace[0].trace;
@@ -2465,7 +2464,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa
24652464
var moduleCalcData = traceHash[moduleName];
24662465
var _module = moduleCalcData[0][0].trace._module;
24672466

2468-
_module.plot(subplot, Lib.filterVisible(moduleCalcData), subplotLayout);
2467+
_module.plot(gd, subplot, Lib.filterVisible(moduleCalcData), subplotLayout);
24692468
}
24702469

24712470
// update moduleName -> calcData hash

src/plots/polar/polar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ proto.plot = function(polarCalcData, fullLayout) {
8585

8686
_this.updateLayers(fullLayout, polarLayout);
8787
_this.updateLayout(fullLayout, polarLayout);
88-
Plots.generalUpdatePerTraceModule(_this, polarCalcData, polarLayout);
88+
Plots.generalUpdatePerTraceModule(_this.gd, _this, polarCalcData, polarLayout);
8989
_this.updateFx(fullLayout, polarLayout);
9090
};
9191

@@ -837,7 +837,7 @@ proto.updateRadialDrag = function(fullLayout, polarLayout) {
837837
var _module = moduleCalcData[0][0].trace._module;
838838
var polarLayoutNow = gd._fullLayout[_this.id];
839839

840-
_module.plot(_this, moduleCalcDataVisible, polarLayoutNow);
840+
_module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow);
841841

842842
if(!Registry.traceIs(k, 'gl')) {
843843
for(var i = 0; i < moduleCalcDataVisible.length; i++) {
@@ -962,7 +962,7 @@ proto.updateAngularDrag = function(fullLayout, polarLayout) {
962962
var _module = moduleCalcData[0][0].trace._module;
963963
var polarLayoutNow = gd._fullLayout[_this.id];
964964

965-
_module.plot(_this, moduleCalcDataVisible, polarLayoutNow);
965+
_module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow);
966966
}
967967
}
968968
}

src/plots/ternary/ternary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ proto.plot = function(ternaryCalcData, fullLayout) {
6464

6565
_this.updateLayers(ternaryLayout);
6666
_this.adjustLayout(ternaryLayout, graphSize);
67-
Plots.generalUpdatePerTraceModule(_this, ternaryCalcData, ternaryLayout);
67+
Plots.generalUpdatePerTraceModule(_this.graphDiv, _this, ternaryCalcData, ternaryLayout);
6868
_this.layers.plotbg.select('path').call(Color.fill, ternaryLayout.bgcolor);
6969
};
7070

src/traces/choropleth/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var getTopojsonFeatures = require('../../lib/topojson_utils').getTopojsonFeature
1717
var locationToFeature = require('../../lib/geo_location_utils').locationToFeature;
1818
var style = require('./style');
1919

20-
module.exports = function plot(geo, calcData) {
20+
module.exports = function plot(gd, geo, calcData) {
2121
for(var i = 0; i < calcData.length; i++) {
2222
calcGeoJSON(calcData[i], geo.topojson);
2323
}
@@ -45,7 +45,7 @@ module.exports = function plot(geo, calcData) {
4545
paths.exit().remove();
4646

4747
// call style here within topojson request callback
48-
style(geo.graphDiv, calcTrace);
48+
style(gd, calcTrace);
4949
});
5050
};
5151

src/traces/scattergeo/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var geoJsonUtils = require('../../lib/geojson_utils');
1919
var subTypes = require('../scatter/subtypes');
2020
var style = require('./style');
2121

22-
module.exports = function plot(geo, calcData) {
22+
module.exports = function plot(gd, geo, calcData) {
2323
for(var i = 0; i < calcData.length; i++) {
2424
calcGeoJSON(calcData[i], geo.topojson);
2525
}
@@ -79,7 +79,7 @@ module.exports = function plot(geo, calcData) {
7979
}
8080

8181
// call style here within topojson request callback
82-
style(geo.graphDiv, calcTrace);
82+
style(gd, calcTrace);
8383
});
8484
};
8585

src/traces/scatterpolar/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
var scatterPlot = require('../scatter/plot');
1212
var BADNUM = require('../../constants/numerical').BADNUM;
1313

14-
module.exports = function plot(subplot, moduleCalcData) {
14+
module.exports = function plot(gd, subplot, moduleCalcData) {
1515
var i, j;
1616

1717
var plotinfo = {
@@ -60,5 +60,5 @@ module.exports = function plot(subplot, moduleCalcData) {
6060
}
6161
}
6262

63-
scatterPlot(subplot.graphDiv, plotinfo, moduleCalcData);
63+
scatterPlot(gd, plotinfo, moduleCalcData);
6464
};

src/traces/scatterpolargl/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ function calc(container, trace) {
2929
stash.r = rArray;
3030
stash.theta = thetaArray;
3131

32-
// FIXME: remove this once .plot API gets compatible w/others
33-
stash.container = container;
34-
3532
Axes.expand(radialAxis, rArray, {tozero: true});
3633

3734
if(angularAxis.type !== 'linear') {
@@ -42,10 +39,7 @@ function calc(container, trace) {
4239
return [{x: false, y: false, t: stash, trace: trace}];
4340
}
4441

45-
46-
function plot(subplot, cdata) {
47-
var stash = cdata[0][0].t;
48-
var container = stash.container;
42+
function plot(container, subplot, cdata) {
4943
var radialAxis = subplot.radialAxis;
5044
var angularAxis = subplot.angularAxis;
5145
var rRange = radialAxis.range;

src/traces/scatterternary/plot.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
var scatterPlot = require('../scatter/plot');
1313

14-
15-
module.exports = function plot(ternary, moduleCalcData) {
14+
module.exports = function plot(gd, ternary, moduleCalcData) {
1615
var plotContainer = ternary.plotContainer;
1716

1817
// remove all nodes inside the scatter layer
@@ -26,5 +25,5 @@ module.exports = function plot(ternary, moduleCalcData) {
2625
layerClipId: ternary._hasClipOnAxisFalse ? ternary.clipIdRelative : null
2726
};
2827

29-
scatterPlot(ternary.graphDiv, plotinfo, moduleCalcData);
28+
scatterPlot(gd, plotinfo, moduleCalcData);
3029
};

test/jasmine/tests/plots_test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,19 @@ describe('Test Plots', function() {
546546
describe('Plots.generalUpdatePerTraceModule', function() {
547547

548548
function _update(subplotCalcData, traceHashOld) {
549+
var gd = {};
549550
var subplot = { traceHash: traceHashOld || {} };
550551
var calcDataPerModule = [];
551552

552-
var plot = function(_, moduleCalcData) {
553+
var plot = function(gd, subplot, moduleCalcData) {
553554
calcDataPerModule.push(moduleCalcData);
554555
};
555556

556557
subplotCalcData.forEach(function(calcTrace) {
557558
calcTrace[0].trace._module = { plot: plot };
558559
});
559560

560-
Plots.generalUpdatePerTraceModule(subplot, subplotCalcData, {});
561+
Plots.generalUpdatePerTraceModule(gd, subplot, subplotCalcData, {});
561562

562563
return {
563564
traceHash: subplot.traceHash,

0 commit comments

Comments
 (0)