@@ -29,7 +29,6 @@ var Drawing = require('../components/drawing');
29
29
var Color = require ( '../components/color' ) ;
30
30
var xmlnsNamespaces = require ( '../constants/xmlns_namespaces' ) ;
31
31
var svgTextUtils = require ( '../lib/svg_text_utils' ) ;
32
- var clearGlCanvases = require ( '../lib/clear_gl_canvases' ) ;
33
32
34
33
var defaultConfig = require ( './plot_config' ) ;
35
34
var manageArrays = require ( './manage_arrays' ) ;
@@ -38,10 +37,6 @@ var subroutines = require('./subroutines');
38
37
var editTypes = require ( './edit_types' ) ;
39
38
40
39
var cartesianConstants = require ( '../plots/cartesian/constants' ) ;
41
- var axisConstraints = require ( '../plots/cartesian/constraints' ) ;
42
- var enforceAxisConstraints = axisConstraints . enforce ;
43
- var cleanAxisConstraints = axisConstraints . clean ;
44
- var doAutoRange = require ( '../plots/cartesian/autorange' ) . doAutoRange ;
45
40
46
41
var numericNameWarningCount = 0 ;
47
42
var numericNameWarningCountLimit = 5 ;
@@ -331,15 +326,7 @@ exports.plot = function(gd, data, layout, config) {
331
326
function doAutoRangeAndConstraints ( ) {
332
327
if ( gd . _transitioning ) return ;
333
328
334
- var axList = Axes . list ( gd , '' , true ) ;
335
- for ( var i = 0 ; i < axList . length ; i ++ ) {
336
- var ax = axList [ i ] ;
337
- cleanAxisConstraints ( gd , ax ) ;
338
-
339
- doAutoRange ( ax ) ;
340
- }
341
-
342
- enforceAxisConstraints ( gd ) ;
329
+ subroutines . doAutoRangeAndConstraints ( gd ) ;
343
330
344
331
// store initial ranges *after* enforcing constraints, otherwise
345
332
// we will never look like we're at the initial ranges
@@ -351,83 +338,6 @@ exports.plot = function(gd, data, layout, config) {
351
338
return Axes . doTicks ( gd , graphWasEmpty ? '' : 'redraw' ) ;
352
339
}
353
340
354
- // Now plot the data
355
- function drawData ( ) {
356
- var calcdata = gd . calcdata ,
357
- i ,
358
- rangesliderContainers = fullLayout . _infolayer . selectAll ( 'g.rangeslider-container' ) ;
359
-
360
- // in case of traces that were heatmaps or contour maps
361
- // previously, remove them and their colorbars explicitly
362
- for ( i = 0 ; i < calcdata . length ; i ++ ) {
363
- var trace = calcdata [ i ] [ 0 ] . trace ,
364
- isVisible = ( trace . visible === true ) ,
365
- uid = trace . uid ;
366
-
367
- if ( ! isVisible || ! Registry . traceIs ( trace , '2dMap' ) ) {
368
- var query = (
369
- '.hm' + uid +
370
- ',.contour' + uid +
371
- ',#clip' + uid
372
- ) ;
373
-
374
- fullLayout . _paper
375
- . selectAll ( query )
376
- . remove ( ) ;
377
-
378
- rangesliderContainers
379
- . selectAll ( query )
380
- . remove ( ) ;
381
- }
382
-
383
- if ( ! isVisible || ! trace . _module . colorbar ) {
384
- fullLayout . _infolayer . selectAll ( '.cb' + uid ) . remove ( ) ;
385
- }
386
- }
387
-
388
- // TODO does this break or slow down parcoords??
389
- clearGlCanvases ( gd ) ;
390
-
391
- // loop over the base plot modules present on graph
392
- var basePlotModules = fullLayout . _basePlotModules ;
393
- for ( i = 0 ; i < basePlotModules . length ; i ++ ) {
394
- basePlotModules [ i ] . plot ( gd ) ;
395
- }
396
-
397
- // keep reference to shape layers in subplots
398
- var layerSubplot = fullLayout . _paper . selectAll ( '.layer-subplot' ) ;
399
- fullLayout . _shapeSubplotLayers = layerSubplot . selectAll ( '.shapelayer' ) ;
400
-
401
- // styling separate from drawing
402
- Plots . style ( gd ) ;
403
-
404
- // show annotations and shapes
405
- Registry . getComponentMethod ( 'shapes' , 'draw' ) ( gd ) ;
406
- Registry . getComponentMethod ( 'annotations' , 'draw' ) ( gd ) ;
407
-
408
- // source links
409
- Plots . addLinks ( gd ) ;
410
-
411
- // Mark the first render as complete
412
- fullLayout . _replotting = false ;
413
-
414
- return Plots . previousPromises ( gd ) ;
415
- }
416
-
417
- // An initial paint must be completed before these components can be
418
- // correctly sized and the whole plot re-margined. fullLayout._replotting must
419
- // be set to false before these will work properly.
420
- function finalDraw ( ) {
421
- Registry . getComponentMethod ( 'shapes' , 'draw' ) ( gd ) ;
422
- Registry . getComponentMethod ( 'images' , 'draw' ) ( gd ) ;
423
- Registry . getComponentMethod ( 'annotations' , 'draw' ) ( gd ) ;
424
- Registry . getComponentMethod ( 'legend' , 'draw' ) ( gd ) ;
425
- Registry . getComponentMethod ( 'rangeslider' , 'draw' ) ( gd ) ;
426
- Registry . getComponentMethod ( 'rangeselector' , 'draw' ) ( gd ) ;
427
- Registry . getComponentMethod ( 'sliders' , 'draw' ) ( gd ) ;
428
- Registry . getComponentMethod ( 'updatemenus' , 'draw' ) ( gd ) ;
429
- }
430
-
431
341
var seq = [
432
342
Plots . previousPromises ,
433
343
addFrames ,
@@ -439,9 +349,10 @@ exports.plot = function(gd, data, layout, config) {
439
349
seq . push ( subroutines . layoutStyles ) ;
440
350
if ( hasCartesian ) seq . push ( drawAxes ) ;
441
351
seq . push (
442
- drawData ,
443
- finalDraw ,
352
+ subroutines . drawData ,
353
+ subroutines . finalDraw ,
444
354
initInteractions ,
355
+ Plots . addLinks ,
445
356
Plots . rehover ,
446
357
Plots . previousPromises
447
358
) ;
0 commit comments