How to build a pie chart

I am trying to create a pie chart.

However, I need a sample code to create one myself because I am not using other packages. I’m using the anvil one and I need some sample code for my reference.

Hi, @nitin.srinivasan28, and welcome to the Forum!

Anvil’s plots are Plotly plots, which are configured by using classes from the plotly.graph_objects module. This means that you’ll have to refer to their documentation to find out how to create a specific type of plot.

In this case, you’ll want to do something like this:

    self.plot_1.data = go.Pie(
      labels=['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen'],
      values=[4500, 2500, 1053, 500])
2 Likes