@@ -708,6 +708,21 @@ def frame_args(duration):
708
708
709
709
710
710
def make_trace_spec (args , constructor , attrs , trace_patch ):
711
+ if constructor in [go .Scatter , go .Scatterpolar ]:
712
+ if "render_mode" in args and (
713
+ args ["render_mode" ] == "webgl"
714
+ or (
715
+ args ["render_mode" ] == "auto"
716
+ and len (args ["data_frame" ]) > 1000
717
+ and args ["animation_frame" ] is None
718
+ )
719
+ ):
720
+ if constructor == go .Scatter :
721
+ constructor = go .Scattergl
722
+ if "orientation" in trace_patch :
723
+ del trace_patch ["orientation" ]
724
+ else :
725
+ constructor = go .Scatterpolargl
711
726
# Create base trace specification
712
727
result = [TraceSpec (constructor , attrs , trace_patch , None )]
713
728
@@ -1555,24 +1570,8 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
1555
1570
trace_names = trace_names_by_frame [frame_name ]
1556
1571
1557
1572
for trace_spec in trace_specs :
1558
- constructor_to_use = trace_spec .constructor
1559
- if constructor_to_use in [go .Scatter , go .Scatterpolar ]:
1560
- if "render_mode" in args and (
1561
- args ["render_mode" ] == "webgl"
1562
- or (
1563
- args ["render_mode" ] == "auto"
1564
- and len (args ["data_frame" ]) > 1000
1565
- and args ["animation_frame" ] is None
1566
- )
1567
- ):
1568
- if constructor_to_use == go .Scatter :
1569
- constructor_to_use = go .Scattergl
1570
- if "orientation" in trace_patch :
1571
- del trace_patch ["orientation" ]
1572
- else :
1573
- constructor_to_use = go .Scatterpolargl
1574
1573
# Create the trace
1575
- trace = constructor_to_use (name = trace_name )
1574
+ trace = trace_spec . constructor (name = trace_name )
1576
1575
if trace_spec .constructor not in [
1577
1576
go .Parcats ,
1578
1577
go .Parcoords ,
0 commit comments