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 |