Skip to content

Commit 0b07dbd

Browse files
committed
rm existence check for plotRegistry[].plot :
- assume that if fullLayout._has[] is set, the corresponding plot module has been registered. If not the case, this will result in an error.
1 parent 3bea1c7 commit 0b07dbd

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/plot_api/plot_api.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,12 @@ Plotly.plot = function(gd, data, layout, config) {
266266
// clean up old scenes that no longer have associated data
267267
// will this be a performance hit?
268268

269-
var registry = plots.subplotsRegistry;
269+
var plotRegistry = plots.subplotsRegistry;
270270

271271
// TODO incorporate cartesian and polar plots into this paradigm
272-
if(fullLayout._hasGL3D && registry.gl3d) registry.gl3d.plot(gd);
273-
if(fullLayout._hasGeo && registry.geo) registry.geo.plot(gd);
274-
if(fullLayout._hasGL2D && registry.gl2d) registry.gl2d.plot(gd);
272+
if(fullLayout._hasGL3D) plotRegistry.gl3d.plot(gd);
273+
if(fullLayout._hasGeo) plotRegistry.geo.plot(gd);
274+
if(fullLayout._hasGL2D) plotRegistry.gl2d.plot(gd);
275275

276276
// in case of traces that were heatmaps or contour maps
277277
// previously, remove them and their colorbars explicitly
@@ -765,9 +765,8 @@ function cleanData(data, existingData) {
765765
if(trace.yaxis) trace.yaxis = Plotly.Axes.cleanId(trace.yaxis, 'y');
766766

767767
// scene ids scene1 -> scene
768-
var plotRegistry = plots.subplotsRegistry;
769-
if(trace.scene && plotRegistry.gl3d) {
770-
trace.scene = plotRegistry.gl3d.cleanId(trace.scene);
768+
if(plots.traceIs(trace, 'gl3d') && trace.scene) {
769+
trace.scene = plots.subplotsRegistry.gl3d.cleanId(trace.scene);
771770
}
772771

773772
if(!plots.traceIs(trace, 'pie')) {
@@ -2494,10 +2493,7 @@ function makePlotFramework(gd) {
24942493
fullLayout = gd._fullLayout;
24952494

24962495
// TODO - find a better place for 3D to initialize axes
2497-
var plotRegistry = plots.subplotsRegistry;
2498-
if(fullLayout._hasGL3D && plotRegistry.gl3d) {
2499-
plotRegistry.gl3d.initAxes(gd);
2500-
}
2496+
if(fullLayout._hasGL3D) plots.subplotsRegistry.gl3d.initAxes(gd);
25012497

25022498
// Plot container
25032499
fullLayout._container = gd3.selectAll('.plot-container').data([0]);

src/plots/plots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ plots.supplyDefaults = function(gd) {
433433
fullTrace = plots.supplyDataDefaults(trace, i, newFullLayout);
434434
newFullData.push(fullTrace);
435435

436-
// DETECT 3D, Cartesian, and Polar
436+
// detect plot type
437437
if(plots.traceIs(fullTrace, 'cartesian')) newFullLayout._hasCartesian = true;
438438
else if(plots.traceIs(fullTrace, 'gl3d')) newFullLayout._hasGL3D = true;
439439
else if(plots.traceIs(fullTrace, 'geo')) newFullLayout._hasGeo = true;

0 commit comments

Comments
 (0)