1515
1616import numpy as np
1717import plotly .graph_objects as go
18- from dash import Input , Output , dcc , html , Dash , no_update , callback_context
18+ from dash import Dash , Input , Output , callback_context , dcc , html , no_update
19+ from trace_updater import TraceUpdater
1920
2021from plotly_resampler import FigureResampler
21- from trace_updater import TraceUpdater
2222
2323# Data that will be used for the plotly-resampler figures
2424x = np .arange (2_000_000 )
3838 html .H1 ("plotly-resampler global variable" , style = {"textAlign" : "center" }),
3939 html .Button ("plot chart" , id = "plot-button" , n_clicks = 0 ),
4040 html .Hr (),
41-
4241 # The graph and it's needed components to update efficiently
4342 dcc .Graph (id = "graph-id" ),
4443 TraceUpdater (id = "trace-updater" , gdID = "graph-id" ),
@@ -59,8 +58,8 @@ def plot_graph(n_clicks):
5958 # Note how the replace method is used here on the global figure object
6059 global fig
6160 fig .replace (go .Figure ())
62- fig .add_trace (go .Scattergl (name = "log" ), hf_x = x , hf_y = noisy_sin * .9999995 ** x )
63- fig .add_trace (go .Scattergl (name = "exp" ), hf_x = x , hf_y = noisy_sin * 1.000002 ** x )
61+ fig .add_trace (go .Scattergl (name = "log" ), hf_x = x , hf_y = noisy_sin * 0 .9999995** x )
62+ fig .add_trace (go .Scattergl (name = "exp" ), hf_x = x , hf_y = noisy_sin * 1.000002 ** x )
6463 return fig
6564 else :
6665 return no_update
0 commit comments