IRONSOFTWAREHOME
Crear gráfico de 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
Crear gráfico de Excel

Crear gráfico de Excel

IronXL admite la creación y edición de gráficos para documentos de Excel en el moderno formato de archivo XLSX.

Este ejemplo muestra cómo crear un LineChart. También se admiten otros tipos de gráficos.

Explora nuestra Guía de creación y edición de gráficos en Excel con C#
Ver en GitHub

¿Listo para empezar?

Nuget Downloads 2,237,574Versión:2026.9recién lanzado

Key in blue circle

Obtenga su clave de prueba gratuita de 30 días al instante.

Your trial license will be sent to your email address

Sin limitaciones. 100 % desbloqueado. Sin tarjeta de crédito.

bullet_checkedNo se requiere tarjeta de crédito ni creación de cuentaSin limitaciones. 100 % desbloqueado. Sin tarjeta de crédito.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Reserve su Demostración en Vivo gratuita
Booking Badge

Confiado por millones de ingenieros en todo el mundo

Logos de clientes de Iron Software
Obtén tu Consulta Sin Compromiso
Completa el formulario a continuación o envía un correo a sales@ironsoftware.com
Tus detalles siempre serán mantenidos confidenciales.
Confiado por millones de ingenieros en todo el mundo
Logos de clientes de Iron Software
Obtenga su Clave de Prueba de 30 días gratis al instante.
No se requiere tarjeta de crédito ni creación de cuenta