We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Exporting a chart with DateTime on x axis

Thread ID:

Created:

Updated:

Platform:

Replies:

94592 May 21,2010 01:31 PM May 24,2010 05:24 AM Windows Forms 1
loading
Tags: XlsIO
Farman Samee
Asked On May 21, 2010 01:31 PM

Hi,

I am exporting charts where the category axis is always of DateTime type. I would like to set the maximum/ minimum values on the category axis, but the properties

chart.PrimaryCategoryAxis.MinimumValue
chart.PrimaryCategoryAxis.MaximumValue

only allow double values to be set. How can I set these for a DateTime axis?

Also, rather than letting Syncfusion/Excel pick the category axis markings arbitrarily, is it possible to force a more sensible system
(e.g. if my x axis spans 20 years, it is sensible to show the first day of each year along the x axis). This won't always happen depending on e.g. my first plotted date. I don't want to insert all category labels manually though!

Thanks.


Geetha M [Syncfusion]
Replied On May 24, 2010 05:24 AM

Hi,

Thank you for your interest in Syncfusion products.

Currently it is not possible to set minimum value and maximum value. However, you can manipulate the labels and use them at IChartSerie.CategoryLabels property. You can manipulate the values for the CategoryAxis and place them inside the sheet (for example the first day of the year if the actual range spans 20 years).

// Create Categorylabels and assign it.
sheet["D1"].DateTime = new DateTime(1989, 1, 1);
sheet["A4:A23"].CopyTo(sheet["D2"], ExcelCopyRangeOptions.All);
sheet["D22"].DateTime = new DateTime(2010, 1, 1);

IChartSerie serie = chartShape.Series[0];
serie.CategoryLabels = sheet["D1:D22"];

// Set the date format
chartShape.PrimaryCategoryAxis.NumberFormat = "ddd, yy";

I have placed the sample in the link below.
http://help.syncfusion.com/samples/XlsIO.Windows/F94592/F94592.zip

Please try this and let me know if you have any questions.

Regards,
Geetha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;