Hi
I am having an issue with my pie chart legends in Dash.
dcc.Graph(
id='Graph8',
figure={
'data' : gen_pie_chart(args),
'legend' : pie_labels,
'layout' : go.Layout(
title='Title of chart',
legend=dict(traceorder='normal'),
)
},
),
The “pie_labels” variable is a list, which is generated from the following bit of code:
def Get_Values2(data):
x_values = []
for index, row in data.iteritems():
x_values.append(index)
return x_values
pie_labels = Get_Values2(a_pandas_series)
But the result I’m getting is the labels are numbers 0 to 5, rather than the text labels that are the index of the series object that I’ve sent to “Get_Values2”:
Untitled
If I print(pie_labels) I get:
[‘0 - 100’, ‘100 - 200’, ‘1000 +’, ‘200 - 300’, ‘300 - 400’, ‘400 - 1000’]
Which are the labels I want.
Any pointers? I’m sure there’s something really simple I’m missing!
Thanks
Chris