@@ -9,10 +9,11 @@ var extendDeepAll = Plotly.Lib.extendDeepAll;
9
9
var NESTED_MODULE = '_nestedModules' ,
10
10
COMPOSED_MODULE = '_composedModules' ,
11
11
IS_SUBPLOT_OBJ = '_isSubplotObj' ,
12
- IS_LINKED_TO_ARRAY = '_isLinkedToArray' ;
12
+ IS_LINKED_TO_ARRAY = '_isLinkedToArray' ,
13
+ DEPRECATED = '_deprecated' ;
13
14
14
15
// list of underscore attributes to keep in schema as is
15
- var UNDERSCORE_ATTRS = [ '_isSubplotObj' , '_deprecated' ] ;
16
+ var UNDERSCORE_ATTRS = [ IS_SUBPLOT_OBJ , IS_LINKED_TO_ARRAY , DEPRECATED ] ;
16
17
17
18
var plotSchema = {
18
19
traces : { } ,
@@ -115,11 +116,12 @@ function getLayoutAttributes() {
115
116
// add IS_SUBPLOT_OBJ attribute
116
117
layoutAttributes = handleSubplotObjs ( layoutAttributes ) ;
117
118
119
+ layoutAttributes = removeUnderscoreAttrs ( layoutAttributes ) ;
120
+ mergeValTypeAndRole ( layoutAttributes ) ;
121
+
118
122
// generate IS_LINKED_TO_ARRAY structure
119
123
layoutAttributes = handleLinkedToArray ( layoutAttributes ) ;
120
124
121
- layoutAttributes = removeUnderscoreAttrs ( layoutAttributes ) ;
122
- mergeValTypeAndRole ( layoutAttributes ) ;
123
125
plotSchema . layout = { layoutAttributes : layoutAttributes } ;
124
126
}
125
127
@@ -278,19 +280,17 @@ function handleSubplotObjs(layoutAttributes) {
278
280
279
281
function handleLinkedToArray ( layoutAttributes ) {
280
282
Object . keys ( layoutAttributes ) . forEach ( function ( k ) {
281
- var attr = clone ( layoutAttributes [ k ] ) ;
283
+ var attr = extendDeep ( { } , layoutAttributes [ k ] ) ;
282
284
283
285
if ( attr [ IS_LINKED_TO_ARRAY ] !== true ) return ;
284
286
285
287
var itemName = k . substr ( 0 , k . length - 1 ) ; // TODO more robust logic
286
288
287
289
delete attr [ IS_LINKED_TO_ARRAY ] ;
288
290
289
- layoutAttributes [ k ] = {
290
- role : 'object' ,
291
- items : { }
292
- } ;
291
+ layoutAttributes [ k ] = { items : { } } ;
293
292
layoutAttributes [ k ] . items [ itemName ] = attr ;
293
+ layoutAttributes [ k ] . role = 'object' ;
294
294
} ) ;
295
295
296
296
return layoutAttributes ;
0 commit comments