I'm generating a chart using EPPlus for Excel. What I want to be able to do is to remove the circled horizontal bars from the graph axes. Does anyone know how to do this? My current code is as below
var p = new ExcelPackage(new FileInfo(fileName));
var openSheet = p.Workbook.Worksheets.First();
var scatterChart = openSheet.Drawings.AddChart("Worm Calc", eChartType.XYScatter);
scatterChart.Series.Add(openSheet.Cells["E3:E103"], openSheet.Cells["F3:F103"]);
scatterChart.Legend.Remove();
scatterChart.XAxis.LogBase = 10;
scatterChart.YAxis.LogBase = 10;
scatterChart.XAxis.RemoveGridlines(true, true); //does not help
scatterChart.XAxis.RemoveGridlines(); //does not help
scatterChart.Title.Text = "Worm Calc";
scatterChart.SetPosition(2, 0, 7, 0);
scatterChart.SetSize(350, 350);
p.SaveAs(new FileInfo(fileName));
The method RemoveGridLines()
will not do it as it was designed to remove the horizontal and vertical lines of the chart (I know, I wrote it :) ).
You are looking to remove the Tick Marks. You only circled some of them on each axis but I assume you actually want to remove ALL of them. To do that:
scatterChart.XAxis.MajorTickMark = eAxisTickMark.None;
scatterChart.XAxis.MinorTickMark = eAxisTickMark.None;
scatterChart.YAxis.MajorTickMark = eAxisTickMark.None;
scatterChart.YAxis.MinorTickMark = eAxisTickMark.None;
If you are looking to remove ONLY those that are circled, AFAIK, excel (nothing to do with EPPlus) cannot do that. It is all or nothing.