Hi Thomas,
Thanks for your inquiry.
According to your information, I think that the error bar could meet your requirement. After testing, I find the data labels of series 2 is unable to set as invisible. I have posted this issue to our Dev team, we will let you know as soon as there is any update.
Below is my testing code, and attached are my files for your reference:
- Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"F:\testing\xls test form\sample document\target line.xlsx");
Worksheet sheet = workbook.Worksheets[0];
//Add Chart and Set Chart Data Range
Chart chart = sheet.Charts.Add(ExcelChartType.ColumnClustered);
chart.DataRange = sheet.Range["A1:C5"];
chart.SeriesDataFromRange = false;
chart.PrimaryValueAxis.HasMajorGridLines = false;
//Chart Position
chart.LeftColumn = 1;
chart.TopRow = 19;
chart.RightColumn = 15;
chart.BottomRow = 40;
ChartSerie ser2 = chart.Series[1];
//this code doesn't work
ser2.DataPoints.DefaultDataPoint.DataLabels.HasValue = false;
ser2.UsePrimaryAxis = true;
//For adding error bar X, change the chart type as scatter marker.
ser2.SerieType = ExcelChartType.ScatterMarkers;
ser2.Format.MarkerStyle = ChartMarkerType.None;
//add the error bar X for the serie
var eb = ser2.ErrorBar(false,ErrorBarIncludeType.Both);
eb.HasCap = false;
eb.Border.Color = Color.Red;
eb.Border.Weight = ChartLineWeightType.Medium;
eb.NumberValue = 0.3;
workbook.SaveToFile("CreatErrorBar16072.xlsx",ExcelVersion.Version2013);
Sincerely,
Betsy
E-iceblue support team