Arbeta med diagram - Aspose.Slides FOSS för Python
Aspose.Slides FOSS for Python provides classes for working with working with charts.
Overview
De viktigaste klasserna är:
ChartChartSeriesChartSeriesCollectionChartSeriesGroupChartSeriesGroupCollection
Att börja
Installera Aspose.Slides FOSS för Python:
pip install aspose-slides-fossGrundläggande användning
import aspose.slides_foss as slides
from aspose.slides_foss.charts import ChartType
from aspose.slides_foss.export import SaveFormat
with slides.Presentation() as prs:
slide = prs.slides[0]
chart = slide.shapes.add_chart(ChartType.CLUSTERED_COLUMN, 100, 100, 500, 400)
# add_chart() seeds the chart with sample series/category data
series = chart.chart_data.series[0]
print(f"Series: {series.name.as_literal_string}, {len(series.data_points)} point(s)")
prs.save("chart.pptx", SaveFormat.PPTX)Tips och bästa praxis
- Alltid avlägsna dokumentobjekt efter användning
- Handla filer I/O undantag när du läser eller skriver filerna
- Se till att API referens För de senaste signaturerna
API Referens sammanfattning
| Class | Description |
|---|---|
Chart | Se referensdokument |
ChartSeries | Se referensdokument |
ChartSeriesCollection | Se referensdokument |
ChartSeriesGroup | Se referensdokument |
ChartSeriesGroupCollection | Se referensdokument |
För fullständig information, se den API referens.