IRONSOFTWAREHOME
Créer un graphique Excel
using IronXL;
using IronXL.Drawing.Charts;

WorkBook workBook = WorkBook.Load("test.xlsx");
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Set the chart type and it's position  on the worksheet.
var 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 horizontal(category) axis.
// The second  parameter represents the address of the range for vertical(value) axis.
var 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 call of this method leads to plotting multiple charts instead of modifying the existing chart.
// Yet there is no possibility to remove chart or edit it's series/position.
// We can just create new one.
chart.Plot();

workBook.SaveAs("CreateLineChart.xlsx");
Imports IronXL
Imports IronXL.Drawing.Charts

Dim workBook As WorkBook = WorkBook.Load("test.xlsx")
Dim workSheet As WorkSheet = workBook.DefaultWorkSheet

' Set the chart type and its position on the worksheet.
Dim 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 horizontal(category) axis.
' The second parameter represents the address of the range for vertical(value) axis.
Dim 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 of this method lead to plotting multiple charts instead of modifying the existing chart.
' Yet there is no possibility to remove chart or edit its series/position.
' We can just create a new one.
chart.Plot()

workBook.SaveAs("CreateLineChart.xlsx")
NuGet Download
PM > Install-Package IronXL.Excel
Créer un graphique Excel

Créer un graphique Excel

IronXL prend en charge la création et la modification de graphiques pour les documents Excel au format de fichier moderne XLSX.

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

Découvrez notre guide de création et de modification de graphiques Excel en C#
Voir sur GitHub

Prêt à commencer?

Nuget Downloads 2,280,941Version :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
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
Bibliothèque C# NuGet pour PDF
Installer avec NuGet

Version : 2026.10

PM > Install-Package IronXL.Excel
nuget.org/packages/IronXL.Excel/
  1. Dans l'explorateur de solutions, faites un clic droit sur Références, Gestion des packages NuGet
  2. Sélectionnez Parcourir et recherchez "IronXL"
  3. Sélectionnez le package et installez
C# PDF DLL
Télécharger DLL

Version : 2026.10

  1. Téléchargez et dézippez IronXL dans un emplacement tel que ~/Libs dans votre répertoire de solution
  2. Dans l'Explorateur de solutions de Visual Studio, cliquez avec le bouton droit sur Références. Sélectionnez Parcourir, "IronXL.dll"

Licences à partir de $999