Free Support Forum -

Setting Min and Max values for Dates

Hi, I have a chart the X axis of which is a Date Series. It is a six months stock chart. How do I set Min and Max values? The MinValue and MaxValue properties only accept doubles and not dates.

Hi Alex,

This feature is not supported yet. I will add it in the future release. It will be available in the next week.

Thanks, I’ll wait a week.

Any word on this?

It’s supported now. Please try the attached dll with the following sample code:

chart.CategoryAxis.CategoryType = CategoryType.TimeScale;
chart.CategoryAxis.MajorUnitScale = TimeUnit.Days;
chart.CategoryAxis.MajorUnit = 60;
chart.CategoryAxis.MinValue = new DateTime(2002, 5, 6);
chart.CategoryAxis.MaxValue = new DateTime(2005, 1, 16);

This is exactly what I need. Except now setting MinValue and MaxValue to a numeric value is broken. I need the CategoryAxis to be Dates but the ValueAxis are numbers, and when I set the

chart.ValueAxis.MinValue = (int)min;

I get an Exception
Aspose.Excel.ExcelException: MinValue should be numeric or Date values.


Hi Alex,

Above fix only accepts double and DateTime value type. I fixed this bug and please try the attached fix.

That worked perfectly.
Thank You.