from bokeh.plotting import figure, output_file, show
import math
output_file("gfg.html")
graph = figure(title = "Bokeh Pie Chart")
sectors = ["Agriculture", "Industry", "Services"]
percentages = [17.1, 29.1, 53.8]
radians = [math.radians((percent / 100) * 360) for percent in percentages]
start_angle = [math.radians(0)]
prev = start_angle[0]
for i in radians[:-1]:
start_angle.append(i + prev)
prev = i + prev
end_angle = start_angle[1:] + [math.radians(0)]
x = 0
y = 0
radius = 1
color = ["yellow", "red", "lightblue"]
for i in range(len(sectors)):
graph.wedge(x, y, radius,
start_angle = start_angle[i],
end_angle = end_angle[i],
color = color[i],
legend_label = sectors[i])
show(graph)