//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.Line, 250, 20, 360, 230); worksheet.Range["A1:D4"].Value = new object[,] { {null, "Q1", "Q2", "Q3"}, {"Mobile Phones", 1330, 2330, 3330}, {"Laptops", 4032, 5632, 6197}, {"Tablets", 6233, 7233, 8233} }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D4"], RowCol.Rows); // Get first series ISeries series1 = shape.Chart.SeriesCollection[0]; // Set HasErrorBars as true series1.HasErrorBars = true; // Config first series' error bar series1.YErrorBar.Type = ErrorBarInclude.Both; series1.YErrorBar.EndStyle = EndStyleCap.Cap; // Get third series ISeries series2 = shape.Chart.SeriesCollection[2]; // Set HasErrorBars as true series2.HasErrorBars = true; // Config third series' error bar series2.YErrorBar.Type = ErrorBarInclude.Plus; series2.YErrorBar.EndStyle = EndStyleCap.NoCap; // Save to an excel file workbook.Save("ConfigErrorBarIncludeAndEndType.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.Line, 250, 20, 360, 230) worksheet.Range("A1:D4").Value = New Object(,) { {Nothing, "Q1", "Q2", "Q3"}, {"Mobile Phones", 1330, 2330, 3330}, {"Laptops", 4032, 5632, 6197}, {"Tablets", 6233, 7233, 8233} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:D4"), RowCol.Rows) 'get first series Dim series1 As ISeries = shape.Chart.SeriesCollection(0) 'set HasErrorBars as true series1.HasErrorBars = True 'config first series' error bar series1.YErrorBar.Type = ErrorBarInclude.Both series1.YErrorBar.EndStyle = EndStyleCap.Cap 'get third series Dim series2 As ISeries = shape.Chart.SeriesCollection(2) 'set HasErrorBar as true series2.HasErrorBars = True 'config third series' error bar series2.YErrorBar.Type = ErrorBarInclude.Plus series2.YErrorBar.EndStyle = EndStyleCap.NoCap ' save to an excel file workbook.Save("ConfigErrorBarIncludeAndEndType.xlsx")