@@ -112,6 +112,7 @@ exports.get = function() {
112112 * @param {String } attrName name string
113113 * @param {object[] } attrs all the attributes
114114 * @param {Number } level the recursion level, 0 at the root
115+ * @param {String } fullAttrString full attribute name (ie 'marker.line')
115116 * @param {Number } [specifiedLevel]
116117 * The level in the tree, in order to let the callback function detect descend or backtrack,
117118 * typically unsupplied (implied 0), just used by the self-recursive call.
@@ -460,11 +461,22 @@ function getTraceAttributes(type) {
460461 // make 'type' the first attribute in the object
461462 attributes . type = null ;
462463
464+
465+ var copyBaseAttributes = extendDeepAll ( { } , baseAttributes ) ;
466+ var copyModuleAttributes = extendDeepAll ( { } , _module . attributes ) ;
467+
468+ // prune global-level trace attributes that are already defined in a trace
469+ exports . crawl ( copyModuleAttributes , function ( attr , attrName , attrs , level , fullAttrString ) {
470+ Lib . nestedProperty ( copyBaseAttributes , fullAttrString ) . set ( undefined ) ;
471+ // Prune undefined attributes
472+ if ( attr === undefined ) Lib . nestedProperty ( copyModuleAttributes , fullAttrString ) . set ( undefined ) ;
473+ } ) ;
474+
463475 // base attributes (same for all trace types)
464- extendDeepAll ( attributes , baseAttributes ) ;
476+ extendDeepAll ( attributes , copyBaseAttributes ) ;
465477
466478 // module attributes
467- extendDeepAll ( attributes , _module . attributes ) ;
479+ extendDeepAll ( attributes , copyModuleAttributes ) ;
468480
469481 // subplot attributes
470482 if ( basePlotModule . attributes ) {
0 commit comments