@@ -21,8 +21,6 @@ var Queue = require('../lib/queue');
21
21
var Plots = require ( '../plots/plots' ) ;
22
22
var Fx = require ( '../plots/cartesian/graph_interact' ) ;
23
23
24
- var Pie = require ( '../traces/pie' ) ;
25
-
26
24
var Color = require ( '../components/color' ) ;
27
25
var Drawing = require ( '../components/drawing' ) ;
28
26
var ErrorBars = require ( '../components/errorbars' ) ;
@@ -268,12 +266,16 @@ Plotly.plot = function(gd, data, layout, config) {
268
266
269
267
function getCdModule ( cdSubplot , _module ) {
270
268
var cdModule = [ ] ;
271
- var i , cd , trace ;
272
- for ( i = 0 ; i < cdSubplot . length ; i ++ ) {
273
- cd = cdSubplot [ i ] ;
274
- trace = cd [ 0 ] . trace ;
275
- if ( trace . _module === _module && trace . visible === true ) cdModule . push ( cd ) ;
269
+
270
+ for ( var i = 0 ; i < cdSubplot . length ; i ++ ) {
271
+ var cd = cdSubplot [ i ] ;
272
+ var trace = cd [ 0 ] . trace ;
273
+
274
+ if ( ( trace . _module === _module ) && ( trace . visible === true ) ) {
275
+ cdModule . push ( cd ) ;
276
+ }
276
277
}
278
+
277
279
return cdModule ;
278
280
}
279
281
@@ -301,7 +303,7 @@ Plotly.plot = function(gd, data, layout, config) {
301
303
302
304
for ( i = 0 ; i < subplots . length ; i ++ ) {
303
305
subplot = subplots [ i ] ;
304
- subplotInfo = gd . _fullLayout . _plots [ subplot ] ;
306
+ subplotInfo = fullLayout . _plots [ subplot ] ;
305
307
cdSubplot = getCdSubplot ( calcdata , subplot ) ;
306
308
cdError = [ ] ;
307
309
@@ -312,7 +314,8 @@ Plotly.plot = function(gd, data, layout, config) {
312
314
313
315
for ( j = 0 ; j < modules . length ; j ++ ) {
314
316
_module = modules [ j ] ;
315
- if ( ! _module . plot ) continue ;
317
+
318
+ if ( ! _module . plot && ( _module . name === 'pie' ) ) continue ;
316
319
317
320
// plot all traces of this type on this subplot at once
318
321
cdModule = getCdModule ( cdSubplot , _module ) ;
@@ -326,16 +329,19 @@ Plotly.plot = function(gd, data, layout, config) {
326
329
}
327
330
328
331
// finally do all error bars at once
329
- if ( gd . _fullLayout . _hasCartesian ) {
332
+ if ( fullLayout . _hasCartesian ) {
330
333
ErrorBars . plot ( gd , subplotInfo , cdError ) ;
331
334
Lib . markTime ( 'done ErrorBars' ) ;
332
335
}
333
336
}
334
337
335
- // now draw stuff not on subplots (ie, pies)
336
- // TODO: gotta be a better way to handle this
337
- var cdPie = getCdModule ( calcdata , Pie ) ;
338
- if ( cdPie . length ) Pie . plot ( gd , cdPie ) ;
338
+ // now draw stuff not on subplots (ie, only pies at the moment)
339
+ if ( fullLayout . _hasPie ) {
340
+ var Pie = Plots . getModule ( 'pie' ) ;
341
+ var cdPie = getCdModule ( calcdata , Pie ) ;
342
+
343
+ if ( cdPie . length ) Pie . plot ( gd , cdPie ) ;
344
+ }
339
345
340
346
// styling separate from drawing
341
347
Plots . style ( gd ) ;
0 commit comments