Hi,
When I open my dashboard in a full sized chrome window, it looks like this. All is fine:
Then when I reduce the widow size, it looks like this. All is fine:
The bug happens when I maximize the window again. The horizontal legend moves out of its original position:
This bug happens to me on multiple PCs. Looking at the html code, the problem is that the transform property of the legend changes.
Initially in a fullscreen window it is transform=“translate(80,350)”
But it changes to transform=“translate(80,294)” on resizing the window to fullscreen.
Please find below some code to reproduce:
import os
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from dash import dcc, html, Input, Output, callback, Dash
#-chart
gdp_level_fig = go.Figure()
for i in range(0,5):
gdp_level_fig.add_bar(x=[1,2,3,4,5,6,7,8,9,10], y=[10,20,30,40,50,60,70,80,90,100])
gdp_level_fig.add_trace(
go.Scatter(
x=[1,2,3,4,5,6,7,8,9,10],
y=[10,20,30,40,50,60,70,80,90,100],
marker=dict(color=“black”),
mode=‘lines+markers’,
)
)
gdp_level_fig.update_layout(legend=dict(orientation=“h”))
gdp_level_chart = dcc.Graph(id=“us_gdp_level”, style={“width”: ‘36%’, “height”: “450px”}, figure=gdp_level_fig)
#-dashboard
app = Dash()
app.layout = [
html.H1(children=‘Title of Dash App’, style={‘textAlign’:‘center’}),
gdp_level_chart
]
if name == ‘main’:
app.run(debug=True)


