Category Axis Time Intervals

Hi Laurence, as I posted in one of my earlier questions on the forum, I am trying to plot a category axis where the MajorUnit and Minor Unit is TimeScale, but not in fixed increments, i.e. not exactly 3 months, 6 months etc. It needs to be the last Friday of the each quarter of the year. It does not appear as though this is supported in Aspose.Cells or in Excel itself.

But is there a way I can, for example, set the MajorUnitScale to TimeScale, no. of days = 1, and then just hide the TickLabels, TickMarks, and MajorGridLines selectively, so that I can display only the stuff for the day I want.

Sure you can. Please try this piece of code with the attached file.

Excel excel = new Excel();
excel.Open("d:\\test\\book10.xls");

int index = excel.Worksheets[0].Charts.Add(ChartType.Column, 10, 4, 22, 11);

Chart chart = excel.Worksheets[0].Charts[index];
chart.NSeries.Add("B1:B3", true);
chart.NSeries.CategoryData = "A1:A3";

chart.ValueAxis.MajorGridLines.IsVisible = false;

chart.CategoryAxis.MajorUnit = 1;
chart.CategoryAxis.MajorTickMark = TickMarkType.None;
chart.CategoryAxis.TickLabelPosition = TickLabelPositionType.None;

excel.Save("d:\\test\\abc.xls");

But what if I want to show only some of the TickMarks, TickLabels and MajorGridLines on the ValueAxis or CategoryAxis?

For example, on a CategoryAxis with 10 dates 1/1/06 thru 1/10/06, how do I show TickMarks, TickLabels and MajorGridLines only for 1/1, 1/4, 1/6 and 1/9, and hide the rest ? (I need to show uneven intervals).

I think it’s impossible because I don’t find that MS Excel supports it.

I thought so, too. I suppose that the TickLabels, MajorTickMarks etc. have to be accessible as collections with some properties for that to be possible.