I have a plotly graph consisting of 3 overlapping bar plots and a line. The data is around 4-5000 points
Whenever I zoom in and out, it takes about a second in response time, which I think is way too slow for this low amount of data. Does anyone have an idea of what I can do to improve the speed?
Below is my code for the figure
def make_summary_fig(data):
fig = go.Figure(
data=[
go.Bar(
x=data['DATE_COL'],
y=data['GROUP1'],
name='Group 1',
marker_line_width=0,
marker_color='cornflowerblue'
),
go.Bar(
x=data['DATE_COL'],
y=data['GROUP2'],
name='Group 2',
marker_line_width=0,
marker_color='firebrick'
),
go.Bar(
x=data['DATE_COL'],
y=data['GROUP3'],
name='Group 3',
marker_line_width=0,
marker_color='darkseagreen'
),
go.Scatter(
x=data['DATE_COL'],
y=data['Group 4'],
name='Group 4',
line=dict(color='orange', dash='dash', width=3),
)
],
)
fig.update_layout(barmode='overlay')
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label="1m",
step="month",
stepmode="backward"),
dict(count=3,
label="3m",
step="month",
stepmode="backward"),
dict(count=1,
label="YTD",
step="year",
stepmode="todate"),
dict(step="all")
])
),
rangeslider=dict(
visible=True
),
type="date"
)
)
fig.update_traces(hovertemplate='Time: %{x}<br>Volume: %{y}')
fig.update_yaxes(fixedrange=True)
fig.add_vline(x=data.time, line_width=1, line_dash="dash", line_color="grey")
return fig