Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The data on my x-axis are datetime. I would like the scale to be 3 months. What property(s) govern that, baseunit?
Others? Baseunit is a double, if I remember correctly, but if you attempt to set it, say,
to xlmonths, you get an exception. What property(s) permit setting baseunit, and others like it?

I figured out how to set axis.minimum/maximumscale using tooadate(), but since the output from that method is float,
the dates as seen by excel are in the 4th millenium. There must be some other property in play here. Can you help with that?

Code Snippet:
C#
xAxis.CategoryType = Excel.XlCategoryType.xlTimeScale;

            // xAxis.BaseUnit = (Excel.XlTimeUnit)Excel.XlDataSeriesDate.xlMonth;
            xAxis.MinimumScale = Convert.ToSingle(minScales[page].ToOADate());
            xAxis.MaximumScale = Convert.ToSingle(maxScales[page].ToOADate());


The BaseUnit setting causes an exception. From the debugger just prior to attempting to execute this line, BaseUnit is set to default value of xlDays.

If the MinimumScale/MaximumScale settings are executed, the date scale on the chart is, like I said, into the 4th Millenium. If I comment those two lines out, the scale on the first chart page look good, but they are default settings.
I'd like to have control. For example, if there are only two data points a year apart, as would be true for the second chart page, the chart is spread out.


Thanks very much for any help.
Posted
Updated 27-Sep-11 19:30pm
v7
Comments
André Kraak 25-Sep-11 11:06am    
Please mentioned any error messages you are receiving and/or supply code that is relevant to your question.

If you wish to change your question use the Improve Question button.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900