@@ -13,6 +13,8 @@ var Plotly = require('../plotly');
1313var d3 = require ( 'd3' ) ;
1414var isNumeric = require ( 'fast-isnumeric' ) ;
1515
16+ var Lib = require ( '../lib' ) ;
17+
1618var plots = module . exports = { } ;
1719
1820var modules = plots . modules = { } ,
@@ -269,7 +271,7 @@ plots.resize = function(gd) {
269271} ;
270272
271273
272- // for use in Plotly. Lib.syncOrAsync, check if there are any
274+ // for use in Lib.syncOrAsync, check if there are any
273275// pending promises in this plot and wait for them
274276plots . previousPromises = function ( gd ) {
275277 if ( ( gd . _promises || [ ] ) . length ) {
@@ -524,7 +526,7 @@ function relinkPrivateKeys(toLayout, fromLayout) {
524526 else if ( Array . isArray ( fromLayout [ k ] ) &&
525527 Array . isArray ( toLayout [ k ] ) &&
526528 fromLayout [ k ] . length &&
527- Plotly . Lib . isPlainObject ( fromLayout [ k ] [ 0 ] ) ) {
529+ Lib . isPlainObject ( fromLayout [ k ] [ 0 ] ) ) {
528530 if ( fromLayout [ k ] . length !== toLayout [ k ] . length ) {
529531 // this should be handled elsewhere, it causes
530532 // ambiguity if we try to deal with it here.
@@ -536,8 +538,8 @@ function relinkPrivateKeys(toLayout, fromLayout) {
536538 relinkPrivateKeys ( toLayout [ k ] [ j ] , fromLayout [ k ] [ j ] ) ;
537539 }
538540 }
539- else if ( Plotly . Lib . isPlainObject ( fromLayout [ k ] ) &&
540- Plotly . Lib . isPlainObject ( toLayout [ k ] ) ) {
541+ else if ( Lib . isPlainObject ( fromLayout [ k ] ) &&
542+ Lib . isPlainObject ( toLayout [ k ] ) ) {
541543 // recurse into objects, but only if they still exist
542544 relinkPrivateKeys ( toLayout [ k ] , fromLayout [ k ] ) ;
543545 if ( ! Object . keys ( toLayout [ k ] ) . length ) delete toLayout [ k ] ;
@@ -550,12 +552,12 @@ plots.supplyDataDefaults = function(traceIn, i, layout) {
550552 defaultColor = Plotly . Color . defaults [ i % Plotly . Color . defaults . length ] ;
551553
552554 function coerce ( attr , dflt ) {
553- return Plotly . Lib . coerce ( traceIn , traceOut , plots . attributes , attr , dflt ) ;
555+ return Lib . coerce ( traceIn , traceOut , plots . attributes , attr , dflt ) ;
554556 }
555557
556558 function coerceSubplotAttr ( subplotType , subplotAttr ) {
557559 if ( ! plots . traceIs ( traceOut , subplotType ) ) return ;
558- return Plotly . Lib . coerce ( traceIn , traceOut ,
560+ return Lib . coerce ( traceIn , traceOut ,
559561 plots . subplotsRegistry [ subplotType ] . attributes , subplotAttr ) ;
560562 }
561563
@@ -615,14 +617,14 @@ plots.supplyDataDefaults = function(traceIn, i, layout) {
615617
616618plots . supplyLayoutGlobalDefaults = function ( layoutIn , layoutOut ) {
617619 function coerce ( attr , dflt ) {
618- return Plotly . Lib . coerce ( layoutIn , layoutOut , plots . layoutAttributes , attr , dflt ) ;
620+ return Lib . coerce ( layoutIn , layoutOut , plots . layoutAttributes , attr , dflt ) ;
619621 }
620622
621- var globalFont = Plotly . Lib . coerceFont ( coerce , 'font' ) ;
623+ var globalFont = Lib . coerceFont ( coerce , 'font' ) ;
622624
623625 coerce ( 'title' ) ;
624626
625- Plotly . Lib . coerceFont ( coerce , 'titlefont' , {
627+ Lib . coerceFont ( coerce , 'titlefont' , {
626628 family : globalFont . family ,
627629 size : Math . round ( globalFont . size * 1.4 ) ,
628630 color : globalFont . color
@@ -928,7 +930,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
928930 if ( typeof d === 'function' ) {
929931 return null ;
930932 }
931- if ( Plotly . Lib . isPlainObject ( d ) ) {
933+ if ( Lib . isPlainObject ( d ) ) {
932934 var o = { } , v , src ;
933935 for ( v in d ) {
934936 // remove private elements and functions
@@ -951,7 +953,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
951953 // in a trace, we will keep the data array.
952954 src = d [ v + 'src' ] ;
953955 if ( typeof src === 'string' && src . indexOf ( ':' ) > 0 ) {
954- if ( ! Plotly . Lib . isPlainObject ( d . stream ) ) {
956+ if ( ! Lib . isPlainObject ( d . stream ) ) {
955957 continue ;
956958 }
957959 }
@@ -978,7 +980,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
978980 // convert native dates to date strings...
979981 // mostly for external users exporting to plotly
980982 if ( d && d . getTime ) {
981- return Plotly . Lib . ms2DateTime ( d ) ;
983+ return Lib . ms2DateTime ( d ) ;
982984 }
983985
984986 return d ;
0 commit comments