NumberFormat for date axis is not working

I

Ian Hannah

I am using OWC10 for creating a chart in ASP.NET. I am suing data read from
a SQL Database and I am creating a Y axis and an X axis. The graph is
displaying data read at a number of different dates over a date range. The x
axis is displaying the dates.

The problem I am having is that the date format is always MM/DD/YYYY
regardless of how the NumberFormat is set i.e. dates are always in US format.
I have noticed that if I set the enumeration to either auto or manual the
dates show in the correct format but the graph it wrong. If I set it to
NumberFormatEnum.None then the graph is correct but the date format is wrong.

Does anyone know what I am doing wrong or is there a bug in setting the
NumberFormat?

Ian H
 
P

Peter T

Hi Ian,

I have an addin that removes all links in chart(s) to cells, series data to
named arrays and values into labels and other things. Like you I found
handling International date formats a problem with labels (unlike cells).

After doing some work to see if the potential problem will occur I
workaround by adding a space to the date before writing to the label value.
The label's numberformat remains unchanged (eg international date) and if
the label's value is read back it automatically gets reconverted to the
'true' date. Not entirely satisfactory but works well enough.

Regards,
Peter T

As a workaround, having established the
 
S

Sputnik

Hi Peter,

Adding the space shows the whole date but I want to change the date
format.

This is what I am doing:

// Add the dates to the array
rgDates.Add(SqlData.GetDateTime(idxDate));

// Set the dates
Series.SetData(ChartDimensionsEnum.chDimCategories,
(int)ChartSpecialDataSourcesEnum.chDataLiteral,
rgDates.ToArray());

DateAxis.HasTitle = true;
DateAxis.NumberFormat = "MM/YYYY"

DateAxis.GroupingType = ChartAxisGroupingEnum.chAxisGroupingNone;
// DateAxis.GroupingType = ChartAxisGroupingEnum.chAxisGroupingAuto;

If I comment out the chAxisGroupingNone line and uncomment the line
below then the date formatting works and I have no idea why!

Ian
 
P

Peter T

Hi Ian,

Ah, somehow despite the fact you clearly said Axis somehow I read Labels!

I can only think that was because I don't have a problem with International
date format in Axes but I certainly do when writing to Label values.

I also assumed you were working with an 'Excel' chart but it seems you are
working with an Office Web Component, anything here -

http://support.microsoft.com/kb/289288/

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top