Hi Everyone,
I have a script to display chart with respect to drop down selection interval. I would like to display loading animation when view chose the selection. Is it possible to implement this? If so, pls advise to me. My function to display the chart is as follows:
def display_chart_v(csv_file_1, start_time_str, v_num, tm, v_limit):
df = pd.read_csv(csv_file_1, na_values=['NAN'])
df['TS'] = pd.to_datetime(df['TS'])
df = df[df['TS'] >= start_time_str]
fig = go.Figure()
fig.add_trace(go.Scatter(x=df["TS"], y=abs(df[f'v{v_num}_x']), name='Max X', yaxis='y', line=dict(color="red")))
fig.add_trace(go.Scatter(x=df["TS"], y=abs(df[f'v{v_num}_y']), name='Max Y', yaxis='y', line=dict(color="orange")))
fig.add_trace(go.Scatter(x=df["TS"], y=abs(df[f'v{v_num}_z']), name='Max Z', yaxis='y', line=dict(color="greenyellow")))
fig.add_trace(go.Scatter(x=df["TS"], y=[v_limit] * len(df), mode='lines', name=f'Limit ({v_limit}mm/s)', line=dict(color='greenyellow', dash='dash')))
fig.update_layout(
title=f"V{v_num} - Maximum Vibration (mm/s) [1min interval]",
title_x=0.5, title_y=0.85,
yaxis=dict(title="Max. Vibration Velocity (mm/s)", side="left", range=[0, v_limit + 3], zeroline=False,
gridcolor='lightgrey',
mirror=True, showline=True, linecolor='grey', ticks='outside'),
xaxis=dict(gridcolor='lightgrey', side="bottom", showline=True, linecolor='grey', linewidth=1, mirror=True,
ticks='outside'),
legend=dict(orientation="h", y=-0.30),
plot_bgcolor='rgba(0, 0, 0, 0)', # Set the background to transparent
template=tm
)
return fig
Thanks in advance.
Rgds,
Thein