//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(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 style of first series' error bar series1.YErrorBar.Format.Line.Color.RGB = System.Drawing.Color.Red; series1.YErrorBar.Format.Line.Weight = 2; // Save to an excel file workbook.Save("ConfigErrorBarStyle.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 style of first series' error bar series1.YErrorBar.Format.Line.Color.RGB = Color.Red series1.YErrorBar.Format.Line.Weight = 2 ' save to an excel file workbook.Save("ConfigErrorBarStyle.xlsx")