ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  setLabels() for xychart - problem showing specific date
Posted by Daniela Birkelbach on Oct-11-2013 23:54
we've been using the chartdirector control for almost 10 years and it's been working great.  Now, a customer brought to my attention that he was not able to see the 'day' for 10/01/2013.  He could see it again for 10/02/2013.  I was able to recreate it for 10/01/2012 and 10/01/2013.  Any other day is fine.

The label shows the date as 10/2013 whereas it shows all other dates as mm/dd/yyyy.  I'm thinking it might have something to do with trailing zero butting up next to a leading zero somehow.

Is this something that you're aware of?  I can 'produce' the problem by changing our database accordingly.  Here is our code:

XYChart chartComparison;
ArrayList dt_testDates;

DateTime[] arr_dt_testDates = ((DateTime[])dt_testDates.ToArray(typeof(DateTIme)));

chartComparison.xAxis().setLabels(arr_dt_testDates);

Thank you for your time.

Daniela

  Re: setLabels() for xychart - problem showing specific date
Posted by Peter Kwan on Oct-12-2013 01:42
Hi Daniela,

If you specify an array of DateTime but do not specify the date/time format to use, ChartDirector has to decide on a format to use. For example, if your DateTime contains something  2013-8-12 11:22:48, then ChartDirector may choose "yyyy-mm-dd hh:nn:ss" as the format. If the DateTime objects are [2009-1-1 00:00:00, 2010-1-1 00:00:00, 2011-1-1 00:00:00, 2012-1-1 00:00:00 2013-1-1 00:00:00], then ChartDirector may choose "yyyy" as the format. It is because if all the dates are at the start of a year, ChartDirector may guess that the intention may actually be a yearly chart, and the only important information is the year. The month, day of month, hour, minutes and seconds are probably not important.

For your case, is it possible that all your dates are for the first date of a month? Similarly to the "yyyy" format, if all dates are at the first day of a month, ChartDirector may choose "yyyy-mm" as the format.

If you would like to use a specific format regardless of the dates, you may specify the format. For example:

chart_Comparison.xAxis().setLabels2(arr_dt_testDates, "{value|mm/dd/yyyy}");

I have just tested myself using ChartDirector 5.1.1 with the dates:

ArrayList dt_testDates = new ArrayList();
dt_testDates.Add(new DateTime(2012, 10, 1));
dt_testDates.Add(new DateTime(2013, 6, 1));
dt_testDates.Add(new DateTime(2013, 9, 2));
dt_testDates.Add(new DateTime(2013, 10, 1));
dt_testDates.Add(new DateTime(2013, 11, 1));

With the above dates, all the dates will be formatted as "yyyy-mm-dd". However, if I change 2013-09-02 to 2013-09-01, all the dates will be formatted as "yyyy-mm", as all dates would then be at the start of a month.

Regards
Peter Kwan

  Re: setLabels() for xychart - problem showing specific date
Posted by Daniela Birkelbach on Oct-12-2013 02:26
Thank you very much, Peter.  That was very helpful.  Your company is the best in your support and quality control!