pyecharts pie.add()
时间: 2023-10-21 18:13:19 浏览: 127
The `pie.add()` method in Pyecharts is used to add data to a pie chart. It takes several parameters:
- `name`: the name of the series
- `data_pair`: a list of tuples containing the data values and their corresponding labels
- `radius`: the radius of the pie chart
- `center`: the center position of the pie chart
- `rosetype`: the type of rosetype used in the chart (optional)
- `label_opts`: the label options for the chart (optional)
Example usage:
```python
from pyecharts.charts import Pie
data = [('A', 10), ('B', 20), ('C', 30)]
pie = Pie()
pie.add('Data', data)
pie.render('pie_chart.html')
```
This will create a pie chart with the name 'Data' and the data values and labels specified in the `data` list. The chart will be saved as an HTML file called 'pie_chart.html'.
阅读全文