@@ -13,6 +13,8 @@ var Plotly = require('../plotly');
13
13
var d3 = require ( 'd3' ) ;
14
14
var isNumeric = require ( 'fast-isnumeric' ) ;
15
15
16
+ var Lib = require ( '../lib' ) ;
17
+
16
18
var plots = module . exports = { } ;
17
19
18
20
var modules = plots . modules = { } ,
@@ -269,7 +271,7 @@ plots.resize = function(gd) {
269
271
} ;
270
272
271
273
272
- // for use in Plotly. Lib.syncOrAsync, check if there are any
274
+ // for use in Lib.syncOrAsync, check if there are any
273
275
// pending promises in this plot and wait for them
274
276
plots . previousPromises = function ( gd ) {
275
277
if ( ( gd . _promises || [ ] ) . length ) {
@@ -524,7 +526,7 @@ function relinkPrivateKeys(toLayout, fromLayout) {
524
526
else if ( Array . isArray ( fromLayout [ k ] ) &&
525
527
Array . isArray ( toLayout [ k ] ) &&
526
528
fromLayout [ k ] . length &&
527
- Plotly . Lib . isPlainObject ( fromLayout [ k ] [ 0 ] ) ) {
529
+ Lib . isPlainObject ( fromLayout [ k ] [ 0 ] ) ) {
528
530
if ( fromLayout [ k ] . length !== toLayout [ k ] . length ) {
529
531
// this should be handled elsewhere, it causes
530
532
// ambiguity if we try to deal with it here.
@@ -536,8 +538,8 @@ function relinkPrivateKeys(toLayout, fromLayout) {
536
538
relinkPrivateKeys ( toLayout [ k ] [ j ] , fromLayout [ k ] [ j ] ) ;
537
539
}
538
540
}
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 ] ) ) {
541
543
// recurse into objects, but only if they still exist
542
544
relinkPrivateKeys ( toLayout [ k ] , fromLayout [ k ] ) ;
543
545
if ( ! Object . keys ( toLayout [ k ] ) . length ) delete toLayout [ k ] ;
@@ -550,12 +552,12 @@ plots.supplyDataDefaults = function(traceIn, i, layout) {
550
552
defaultColor = Plotly . Color . defaults [ i % Plotly . Color . defaults . length ] ;
551
553
552
554
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 ) ;
554
556
}
555
557
556
558
function coerceSubplotAttr ( subplotType , subplotAttr ) {
557
559
if ( ! plots . traceIs ( traceOut , subplotType ) ) return ;
558
- return Plotly . Lib . coerce ( traceIn , traceOut ,
560
+ return Lib . coerce ( traceIn , traceOut ,
559
561
plots . subplotsRegistry [ subplotType ] . attributes , subplotAttr ) ;
560
562
}
561
563
@@ -615,14 +617,14 @@ plots.supplyDataDefaults = function(traceIn, i, layout) {
615
617
616
618
plots . supplyLayoutGlobalDefaults = function ( layoutIn , layoutOut ) {
617
619
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 ) ;
619
621
}
620
622
621
- var globalFont = Plotly . Lib . coerceFont ( coerce , 'font' ) ;
623
+ var globalFont = Lib . coerceFont ( coerce , 'font' ) ;
622
624
623
625
coerce ( 'title' ) ;
624
626
625
- Plotly . Lib . coerceFont ( coerce , 'titlefont' , {
627
+ Lib . coerceFont ( coerce , 'titlefont' , {
626
628
family : globalFont . family ,
627
629
size : Math . round ( globalFont . size * 1.4 ) ,
628
630
color : globalFont . color
@@ -928,7 +930,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
928
930
if ( typeof d === 'function' ) {
929
931
return null ;
930
932
}
931
- if ( Plotly . Lib . isPlainObject ( d ) ) {
933
+ if ( Lib . isPlainObject ( d ) ) {
932
934
var o = { } , v , src ;
933
935
for ( v in d ) {
934
936
// remove private elements and functions
@@ -951,7 +953,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
951
953
// in a trace, we will keep the data array.
952
954
src = d [ v + 'src' ] ;
953
955
if ( typeof src === 'string' && src . indexOf ( ':' ) > 0 ) {
954
- if ( ! Plotly . Lib . isPlainObject ( d . stream ) ) {
956
+ if ( ! Lib . isPlainObject ( d . stream ) ) {
955
957
continue ;
956
958
}
957
959
}
@@ -978,7 +980,7 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults){
978
980
// convert native dates to date strings...
979
981
// mostly for external users exporting to plotly
980
982
if ( d && d . getTime ) {
981
- return Plotly . Lib . ms2DateTime ( d ) ;
983
+ return Lib . ms2DateTime ( d ) ;
982
984
}
983
985
984
986
return d ;
0 commit comments