-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Using gunicorn to deploy a dash app with plotly-resampler in Linux #300
Comments
Hi @SMOKTEA, Thank you for providing such a detailed description. I was able to reproduce your example quite easily. 👏🏼 It appears that your (modified) example appears to work for me (tested it in both Firefox and Chromium). Adapted import numpy as np
import plotly.graph_objects as go
from dash import dcc, Dash, html
from plotly_resampler import FigureResampler
app = Dash(__name__)
server = app.server
fig = FigureResampler()
x = np.arange(1_000_000)
sin = (3 + np.sin(x / 200) + np.random.randn(len(x)) / 10) * x / 1_000
fig.add_trace(
go.Scattergl(
x=x,
y=sin,
name='demo',
mode='lines+markers'
),
max_n_samples=int(len(x) * 0.2)
)
app.layout = html.Div([ dcc.Graph(id='demo-graph', figure=fig)])
fig.register_update_graph_callback(app, 'demo-graph')
if __name__ == '__main__':
app.run(debug=True) Bash command that I utilized to start the gunicorn app (after installing gunicorn and gunicorn in python env): poetry run gunicorn --workers=2 app:server -b :8097 (using both Gif demonstrating my working version: Hope this helps you further, |
Have a nice day |
What do you mean exactly with scaling? zooming, panning, or resetting the axes? :) |
Hi, @jonasvdd I'm sorry for replying you so late cause blockebd by some own work projects these days. You could donwload this zip and try: On the basis of previous, I use flask to combine multiple Dash App likes:
And the other different is I use a Dash callback function to generate the figure options of the graph, likes:
Deploy script change to:
The steps are same likes before: step1. Execute deployment script in Linux OS and visit the Dash app step2. Zoom the figure step3. Click the top-right home icon button to reset the plotly figure, it cannot reset the figure like before. I hope I've described the reproduction method clearly Thx for your attention. |
Hi, @jonasvdd Have you tried the new demo code? It really confuses me. Thx for your attention. |
Hi @SMOKTEA, Thank you for your patience. I took a look at your code and altered it slightly (utilized a more recent However, with these applied changes, everything appears to work as intended. The reset-axes button works as expected. I had also @jvdd test this out (on my updated code version), and on his linux (kubuntu 22.04) machine, It worked as well. I hope you will be able to get it working with my version. |
Thank you sooooooooo much! I will try the newest code later. And could you explain the reason cause this problem? 👍 Thx for your attention. Have a nice day! |
Describe the bug 🖍️
step1. Use gunicorn to deploy it in Linux OS and configure the number of workers more than 1
step2. Scale the figure by dragging the mouse more than 10 times
step3. Click the top-right home icon button to reset the plotly figure, it cannot reset the figure like before.
Reproducing the bug 🔍
app.py
deploy script with gunicorn in Linux:
step1. Execute deployment script in Linux OS and visit the Dash app
step2. Scale the figure by dragging the mouse more than 10 times
step3. Click the top-right home icon button to reset the plotly figure, it cannot reset the figure like before.
Expected behavior 🔧
Environment information: (please complete the following information)
Thx for your attention.
The text was updated successfully, but these errors were encountered: