14
14
from dash import dcc , html
15
15
from dash .dependencies import Input , Output , State
16
16
from tqdm import tqdm
17
- import json
18
17
19
18
import const
20
19
import const_viz
21
20
from arguments import args
22
21
from data .dataloader import load_data
23
- from utils .utils_data import get_modified_time_of_file
24
22
from utils .utils_misc import project_setup
25
23
from utils .utils_visual import get_colors , get_nodes_and_options
26
24
@@ -215,6 +213,13 @@ def add_traces(fig, figure_name2trace):
215
213
# List to keep track of current annotations
216
214
annotations = []
217
215
216
+ def convert_scatter_to_scattergl (scatter ):
217
+ line = { "color" : scatter .line .color , "dash" : scatter .line .dash , "shape" : scatter .line .shape , "width" : scatter .line .width }
218
+ marker = { "size" : scatter .marker .size , 'symbol' : scatter .marker .symbol }
219
+ return go .Scattergl (x = scatter .x , y = scatter .y , xaxis = scatter .xaxis , yaxis = scatter .yaxis , customdata = scatter .customdata ,
220
+ hovertemplate = scatter .hovertemplate , hovertext = scatter .hovertext , legendgroup = scatter .legendgroup ,
221
+ line = line , marker = marker , mode = scatter .mode , name = scatter .name , showlegend = scatter .showlegend ,
222
+ selectedpoints = scatter .selectedpoints , text = scatter .text , textposition = scatter .textposition )
218
223
@app .callback (
219
224
Output ('dygetviz' , 'figure' ),
220
225
Output ('trajectory-names-store' , 'data' ),
@@ -353,16 +358,15 @@ def update_graph(dataset_name, trajectory_names, clickData, current_figure, traj
353
358
elif value in nodes :
354
359
355
360
trace = node2trace [value ]
356
-
361
+ trace = convert_scatter_to_scattergl ( trace )
357
362
if display_node_type :
358
363
label = node2label [value ]
359
364
trace .line ['color' ] = label2colors [label ][idx ]
360
365
print (f"\t Add node:\t { value } ({ label } )" )
361
-
362
366
else :
363
367
trace .line ['color' ] = label2colors [0 ][idx ]
364
- print (f"\t Add node:\t { value } " )
365
-
368
+ print (f"\t Add node:\t { value } " )
369
+
366
370
fig .add_trace (trace )
367
371
368
372
@@ -372,6 +376,8 @@ def update_graph(dataset_name, trajectory_names, clickData, current_figure, traj
372
376
373
377
for idx_node , node in enumerate (label2node [value ]):
374
378
trace = node2trace [node ]
379
+ print ("trying to convert to scattergl3" )
380
+ trace = convert_scatter_to_scattergl (trace )
375
381
trace .line ['color' ] = label2colors [value ][idx_node % 12 ]
376
382
fig .add_trace (trace )
377
383
0 commit comments