//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddChart(GrapeCity.Documents.Excel.Drawing.ChartType.BarStacked100, 250, 20, 360, 230); worksheet.Range["A1:B5"].Value = new object[,] { { 1, 5 }, { 2, 4 }, { 3, 3 }, { 4, 2 }, { 4, 1 } }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:B5"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns); shape.Chart.ChartTitle.Text = "Bar Stacked 100 Chart"; shape.Chart.Legend.Position = GrapeCity.Documents.Excel.Drawing.LegendPosition.Left; // Save to an excel file workbook.Save("BarStacked100Chart.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shape As IShape = worksheet.Shapes.AddChart(ChartType.BarStacked100, 250, 20, 360, 230) worksheet.Range("A1:B5").Value = New Object(,) { {1, 5}, {2, 4}, {3, 3}, {4, 2}, {4, 1} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:B5"), RowCol.Columns) shape.Chart.ChartTitle.Text = "Bar Stacked 100 Chart" shape.Chart.Legend.Position = LegendPosition.Left ' save to an excel file workbook.Save("BarStacked100Chart.xlsx")