10
10
'use strict' ;
11
11
12
12
var Plotly = require ( '../plotly' ) ;
13
+ var Plots = require ( '../plots/plots' ) ;
14
+ var Lib = require ( '../lib' ) ;
13
15
14
- var extendFlat = Plotly . Lib . extendFlat ;
15
- var extendDeep = Plotly . Lib . extendDeep ;
16
- var extendDeepAll = Plotly . Lib . extendDeepAll ;
16
+ var extendFlat = Lib . extendFlat ;
17
+ var extendDeep = Lib . extendDeep ;
18
+ var extendDeepAll = Lib . extendDeepAll ;
17
19
18
20
var NESTED_MODULE = '_nestedModules' ,
19
21
COMPOSED_MODULE = '_composedModules' ,
@@ -38,7 +40,7 @@ var PlotSchema = module.exports = {};
38
40
39
41
40
42
PlotSchema . get = function ( ) {
41
- Plotly . Plots . allTypes
43
+ Plots . allTypes
42
44
. concat ( 'area' ) // FIXME polar 'area' attributes
43
45
. forEach ( getTraceAttributes ) ;
44
46
@@ -56,7 +58,7 @@ PlotSchema.crawl = function(attrs, callback) {
56
58
callback ( attr , attrName , attrs ) ;
57
59
58
60
if ( PlotSchema . isValObject ( attr ) ) return ;
59
- if ( Plotly . Lib . isPlainObject ( attr ) ) PlotSchema . crawl ( attr , callback ) ;
61
+ if ( Lib . isPlainObject ( attr ) ) PlotSchema . crawl ( attr , callback ) ;
60
62
} ) ;
61
63
} ;
62
64
@@ -65,7 +67,7 @@ PlotSchema.isValObject = function(obj) {
65
67
} ;
66
68
67
69
function getTraceAttributes ( type ) {
68
- var globalAttributes = Plotly . Plots . attributes ,
70
+ var globalAttributes = Plots . attributes ,
69
71
_module = getModule ( { type : type } ) ,
70
72
meta = getMeta ( type ) ,
71
73
subplotRegistry = getSubplotRegistry ( type ) ;
@@ -111,7 +113,7 @@ function getTraceAttributes(type) {
111
113
}
112
114
113
115
function getLayoutAttributes ( ) {
114
- var globalLayoutAttributes = Plotly . Plots . layoutAttributes ,
116
+ var globalLayoutAttributes = Plots . layoutAttributes ,
115
117
layoutAttributes = { } ;
116
118
117
119
// layout module attributes (+ nested + composed)
@@ -136,7 +138,7 @@ function getLayoutAttributes() {
136
138
137
139
function getDefs ( ) {
138
140
plotSchema . defs = {
139
- valObjects : Plotly . Lib . valObjects ,
141
+ valObjects : Lib . valObjects ,
140
142
metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'role' ] )
141
143
} ;
142
144
}
@@ -157,7 +159,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {
157
159
nestedAttrs , { } , whichAttrs , type
158
160
) ;
159
161
160
- Plotly . Lib . nestedProperty ( attrsOut , kk )
162
+ Lib . nestedProperty ( attrsOut , kk )
161
163
. set ( extendDeep ( { } , nestedReference ) ) ;
162
164
} ) ;
163
165
return ;
@@ -180,7 +182,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {
180
182
return ;
181
183
}
182
184
183
- attrsOut [ k ] = Plotly . Lib . isPlainObject ( attrsIn [ k ] ) ?
185
+ attrsOut [ k ] = Lib . isPlainObject ( attrsIn [ k ] ) ?
184
186
extendDeepAll ( { } , attrsIn [ k ] ) :
185
187
attrsIn [ k ] ;
186
188
} ) ;
@@ -214,7 +216,7 @@ function mergeValTypeAndRole(attrs) {
214
216
attrs [ attrName + 'src' ] = makeSrcAttr ( attrName ) ;
215
217
}
216
218
}
217
- else if ( Plotly . Lib . isPlainObject ( attr ) ) {
219
+ else if ( Lib . isPlainObject ( attr ) ) {
218
220
// all attrs container objects get role 'object'
219
221
attr . role = 'object' ;
220
222
}
@@ -229,10 +231,10 @@ function getModule(arg) {
229
231
if ( 'type' in arg ) {
230
232
return ( arg . type === 'area' ) ? // FIXME
231
233
{ attributes : polarAreaAttrs } :
232
- Plotly . Plots . getModule ( { type : arg . type } ) ;
234
+ Plots . getModule ( { type : arg . type } ) ;
233
235
}
234
236
235
- var subplotsRegistry = Plotly . Plots . subplotsRegistry ,
237
+ var subplotsRegistry = Plots . subplotsRegistry ,
236
238
_module = arg . module ;
237
239
238
240
if ( subplotsRegistry [ _module ] ) return subplotsRegistry [ _module ] ;
@@ -249,7 +251,7 @@ function removeUnderscoreAttrs(attributes) {
249
251
250
252
function getMeta ( type ) {
251
253
if ( type === 'area' ) return { } ; // FIXME
252
- return Plotly . Plots . modules [ type ] . meta || { } ;
254
+ return Plots . modules [ type ] . meta || { } ;
253
255
}
254
256
255
257
function assignPolarLayoutAttrs ( layoutAttributes ) {
@@ -266,9 +268,9 @@ function assignPolarLayoutAttrs(layoutAttributes) {
266
268
function getSubplotRegistry ( traceType ) {
267
269
if ( traceType === 'area' ) return { } ; // FIXME
268
270
269
- var subplotsRegistry = Plotly . Plots . subplotsRegistry ,
271
+ var subplotsRegistry = Plots . subplotsRegistry ,
270
272
subplotType = Object . keys ( subplotsRegistry ) . filter ( function ( subplotType ) {
271
- return Plotly . Plots . traceIs ( { type : traceType } , subplotType ) ;
273
+ return Plots . traceIs ( { type : traceType } , subplotType ) ;
272
274
} ) [ 0 ] ;
273
275
274
276
if ( subplotType === undefined ) return { } ;
@@ -277,7 +279,7 @@ function getSubplotRegistry(traceType) {
277
279
}
278
280
279
281
function handleSubplotObjs ( layoutAttributes ) {
280
- var subplotsRegistry = Plotly . Plots . subplotsRegistry ;
282
+ var subplotsRegistry = Plots . subplotsRegistry ;
281
283
282
284
Object . keys ( layoutAttributes ) . forEach ( function ( k ) {
283
285
Object . keys ( subplotsRegistry ) . forEach ( function ( subplotType ) {
0 commit comments