//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.BarStacked, 250, 20, 360, 230); worksheet.Range["A1:C4"].Value = new object[,] { { 103, 121, 109 }, { 56, 94, 115 }, { 116, 89, 99 }, { 55, 93, 70 } }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:C4"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns); shape.Chart.ChartTitle.Text = "Bar Stacked Chart"; shape.Chart.Legend.Position = GrapeCity.Documents.Excel.Drawing.LegendPosition.Left; // Save to an excel file workbook.Save("BarStackedChart.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.BarStacked, 250, 20, 360, 230) worksheet.Range("A1:C4").Value = New Object(,) { {103, 121, 109}, {56, 94, 115}, {116, 89, 99}, {55, 93, 70} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:C4"), RowCol.Columns) shape.Chart.ChartTitle.Text = "Bar Stacked Chart" shape.Chart.Legend.Position = LegendPosition.Left ' save to an excel file workbook.Save("BarStackedChart.xlsx")