# Create and Delete Chart

Work with DsExcel to create and delete a chart in a worksheet.

## Content

DsExcel .NET allows users to create and delete chart in spreadsheets as per their requirements.
You can create and delete chart using the properties and methods of the [IShapes Interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShapes.html) and the [IChart interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IChart.html)

## Create Chart

You can create chart in a worksheet by using [AddChart method](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShapes.AddChart.html) of the **IShapes** interface. Using this method, you can add a chart at a particular position by providing position coordinates of the target range. The method has another overload that lets you add a chart directly to the target range. You can use **Add** method of the **ISeriesCollection** class which lets you reflect data over the chart.
Refer to the following example code to create a chart.

```csharp
// Add Data
worksheet.Range["A1:D6"].Value = new object[,]

{
{null, "Revenue", "Profit", "Sales"},
{"North", 10, 25, 25},
{"East", 51, 36, 27},
{"South", 52, 85, 30},
{"West", 22, 65, 65}
};

// Add Chart at a specified position
IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 200, 75, 300, 300);
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], RowCol.Columns, true, true);

// Add Chart at a particular range
// IShape shapeRange = worksheet.Shapes.AddChart(ChartType.ColumnClustered, worksheet.Range["A8:E20"]);
// shapeRange.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], RowCol.Columns, true, true);
```

![](https://cdn.mescius.io/document-site-files/images/e333ad47-35da-43f9-a389-25433765f491/images/create-chart.png)

> !type=note
> **Note**: The targetRange and the chart to be added must exist in the same worksheet. Otherwise, it results into an **InvalidOperationException**.

## Delete Chart

You can delete an existing chart by using [Delete method](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IChart.Delete.html) of the IChart interface.
Refer to the following example code to delete a chart from your spreadsheet.

```C#
// Delete Chart
shape.Chart.Delete();
```