@@ -375,9 +375,10 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
375
375
trace_patch [error_xy ] = {}
376
376
trace_patch [error_xy ][arr ] = trace_data [attr_value ]
377
377
elif attr_name == "custom_data" :
378
- # here we store a data frame in customdata, and it's serialized
379
- # as a list of row lists, which is what we want
380
- trace_patch ["customdata" ] = trace_data [attr_value ]
378
+ if len (attr_value ) > 0 :
379
+ # here we store a data frame in customdata, and it's serialized
380
+ # as a list of row lists, which is what we want
381
+ trace_patch ["customdata" ] = trace_data [attr_value ]
381
382
elif attr_name == "hover_name" :
382
383
if trace_spec .constructor not in [
383
384
go .Histogram ,
@@ -398,6 +399,13 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
398
399
for col in attr_value :
399
400
if hover_is_dict and not attr_value [col ]:
400
401
continue
402
+ if col in [
403
+ args .get ("x" , None ),
404
+ args .get ("y" , None ),
405
+ args .get ("z" , None ),
406
+ args .get ("base" , None ),
407
+ ]:
408
+ continue
401
409
try :
402
410
position = args ["custom_data" ].index (col )
403
411
except (ValueError , AttributeError , KeyError ):
@@ -408,9 +416,10 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
408
416
position
409
417
)
410
418
411
- # here we store a data frame in customdata, and it's serialized
412
- # as a list of row lists, which is what we want
413
- trace_patch ["customdata" ] = trace_data [customdata_cols ]
419
+ if len (customdata_cols ) > 0 :
420
+ # here we store a data frame in customdata, and it's serialized
421
+ # as a list of row lists, which is what we want
422
+ trace_patch ["customdata" ] = trace_data [customdata_cols ]
414
423
elif attr_name == "color" :
415
424
if trace_spec .constructor in [go .Choropleth , go .Choroplethmapbox ]:
416
425
trace_patch ["z" ] = trace_data [attr_value ]
0 commit comments