Hello,
I have a function building the core.Graph figure for me and I noticed that the trace name does only appear in the legend if I have several traces. How can I enforce this even for a single trace?
Here’s the function and caller for context:
def get_graph_figure_from(df):
figure = {
'data': [],
'layout': { 'plot_bgcolor': 'rgb(229,236,246)' }
}
df_group_by = df.groupby('deviceName')
for trace in df_group_by.groups:
name = ' '.join(trace.split(' ')[-2:])
trace_data = {
'x': df_group_by.get_group(trace).loc[:, 'sensorReadingTimestamp'],
'y': df_group_by.get_group(trace).loc[:, 'temperature'],
'name': name,
'mode': 'lines'
}
figure['data'].append(trace_data)
return figure
graph = core.Graph( figure=get_graph_figure_from(temperatures_df))
Thanks