Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default NumberFormat for date axis is not working


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default NumberFormat for date axis is not working

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
"Ian Hannah" wrote in message
...

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default NumberFormat for date axis is not working

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


Peter T wrote:
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
"Ian Hannah" wrote in message
...

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default NumberFormat for date axis is not working

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

"Sputnik" wrote in message
oups.com...
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


Peter T wrote:
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
"Ian Hannah" wrote in message
...

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I force a secondary horizontal axis to act as a date axis? The_Tim Charts and Charting in Excel 5 July 6th 07 05:18 AM
How to give the numberformat the systemdefault date format? ajd[_2_] Excel Programming 1 February 11th 06 03:16 AM
how to draw a chart using x,y axis not the date with x-axis? elshohna Excel Worksheet Functions 0 December 12th 05 12:19 PM
NumberFormat e date Francesco Geri Excel Programming 3 October 21st 05 02:20 PM
Cell Date/Time and NumberFormat issue Paul Excel Programming 1 December 16th 03 12:14 AM


All times are GMT +1. The time now is 10:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"