Piecharts or donut charts using Dash?

Hi There:

I want to write code instead of using the GUI to create the charts.

So far I have dabbed my feet with Dash and when I tried to use some sample piechart code from Plotly, the graph gets generated on the plotly server whereas I want it to run on Dash.

Can someone point me to a sampler code for PieChart construction on Dash?

Also curious to know if there is a way to have Plotly send the piechart to Dash’s server instead of sending it to Plotly’s server.

some pieces of code to plot pie
layout:
html.Div([dcc.Graph(id='vp_port')]
in callback
@app.callback(dash.dependencies.Output('vp_port','figure')

return { ‘data’ : [go.Pie(labels=vid_spisok2,values=sbori2,
hoverinfo=‘label+value+percent’,
textinfo=‘none’ )], ‘layout’ : {‘title’ : title_text}
}

How can i read the labels and values from an xls into this instead of hard coding it in the script?

import pandas as pd
df=pd.read_excel('filename.xls')

more info at https://pythonspot.com/en/read-xls-with-pandas/

In Dash, graphs are generated entirely within the Dash app itself. Data is not sent to the plot.ly servers.

I recommend that you get started by reading the dash tutorial: Part 1. Layout | Dash for Python Documentation | Plotly. It takes a few hours but it’ll save you a lot of time in the long run.