I'm trying to create a Pie chart in plotly. There are no errors, but it won't show up.
I've created a date range picker which works and provides the results I need, but I haven't tried it with the pie chart just yet, as I want to test the chart with some arbitrary numbers first. Can you help me get it running please? Below is the code:
app = dash.Dash()
app.layout = html.Div([
dcc.DatePickerRange(
id='my-date-picker-range',
min_date_allowed=dt(2019, 4, 1),
max_date_allowed=dt(2019, 6, 30),
#initial_visible_month=dt(2019, 4, 1),
end_date=dt(2019, 4, 2),
start_date=dt(2019, 4, 1)
),
html.Div(id='output-container-date-picker-range')
])
@app.callback(
dash.dependencies.Output('output-container-date-picker-range', 'children'),
[dash.dependencies.Input('my-date-picker-range', 'start_date'),
dash.dependencies.Input('my-date-picker-range', 'end_date')])
def update_output(start_date, end_date):
#some calculations
return{
'data': [go.Pie(labels=['Navy','Sand'], values=[50,50],
marker={'colors': ['#EF963B','C93277']},textinfo='label')
],
'layout': go.Layout(
title='distribution',
margin={'l': 100, 'r': 10},
legend={'x': 0, 'y': 1.5},
)
}
if __name__ == '__main__':
app.run_server()