IRONSOFTWAREHOME
Créer un graphique Excel
from ironxl import *

# Load the Excel workbook
workbook = WorkBook.Load("test.xlsx")
worksheet = workbook.DefaultWorkSheet

# Set the chart type and its position on the worksheet.
chart = worksheet.CreateChart(ChartType.Line, 10, 10, 18, 20)

# Add the series to the chart
# The first parameter represents the address of the range for the horizontal(category) axis.
# The second parameter represents the address of the range for the vertical(value) axis.
series = chart.AddSeries("B3:B8", "A3:A8")

# Set the chart title.
series.Title = "Line Chart"

# Set the legend position.
# Can be removed by setting it to None.
chart.SetLegendPosition(LegendPosition.Bottom)

# We can change the position of the chart.
chart.Position.LeftColumnIndex = 2
chart.Position.RightColumnIndex = chart.Position.LeftColumnIndex + 3

# Plot all the data that was added to the chart before.
# Multiple calls to this method lead to plotting multiple charts instead of modifying the existing chart.
# Yet there is no possibility to remove a chart or edit its series/position.
# We can just create a new one.
chart.Plot()

# Save changes with the created line chart
workbook.SaveAs("CreateLineChart.xlsx")
pip install ironxl
Créer un graphique Excel

Créer un graphique Excel

IronXL for Python prend en charge la création et la modification de graphiques dans des documents Excel au format de fichier XLSX moderne.

Cet exemple démontre comment créer un graphique en ligne. D'autres types de graphiques sont également pris en charge.

Explorez le Guide de création et de modification de graphiques Excel en Python

Prêt à commencer?

Version :2026.10vient de sortir

Key in blue circle

Obtenez votre clé d'essai de 30 jours instantanément.

Your trial license will be sent to your email address

Aucune restriction. 100 % débloqué. Pas de carte bancaire.

bullet_checkedAucune carte de crédit ou création de compte requiseAucune restriction. 100 % débloqué. Pas de carte bancaire.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronXL for Python
Réservez votre Démonstration en direct gratuite
Booking Badge

De confiance par des millions d'ingénieurs dans le monde entier

Logos des clients d'Iron Software
Obtenez Votre Consultation sans Engagement
Vos informations seront toujours gardées confidentielles.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
De confiance par des millions d'ingénieurs dans le monde entier
Obtenez votre clé d'essai 30 jours gratuitement.
Aucune carte de crédit ou création de compte requise
Téléchargement du module Python pour Excel
Installer avec pip

Version : 2026.10

  1. Téléchargez et installez Python 3.7+.
  2. Installez pip à partir de pypi.org s'il n'est pas déjà installé.
  3. Exécutez la commande ci-dessus dans le terminal.
Module PDF Python
Télécharger Module

Version : 2026.10

Installer manuellement dans votre projet

  1. Téléchargez le package
  2. Exécutez cette commande depuis le terminal
    pip install IronXL-2026.10-py37-none-win_amd64.whi

Licences à partir de 999 $