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

Message ListMessage List     Post MessagePost Message

  Default date format
Posted by RAJ on Oct-16-2018 21:36
Hi, date formatting is working fine when I have a large date range, it automatically displays mm/yyyy. But over a small date range it displays mm/dd/yyyy (ie US format). I need this to be dd/mm/yyyy format.

I have tried xAxis()->setLabelFormat("{value|dd-mm-yyyy}") (Perl) and this works fine but it prevents the intelligent display, so even long date ranges show dd-mm-yyyy. I need something like setting default locale to GB or UK. Is this possible?

  Re: Default date format
Posted by Peter Kwan on Oct-17-2018 04:16
Hi RAJ,

You can use Axis.setFormatCondition to specify the format to use when all the ticks are monthly aligned, and then specify another format for non-monthly ticks. It is like:

# all ticks are monthly aligned - no need to show the day of month
$c->xAxis()->setFormatCondition("align", 30 * 86400);
$c->xAxis()->setLabelFormat("{value|mm/yyyy}");

# not all ticks are monthly aligned - need to show the day of month
$c->xAxis()->setFormatCondition("else");
$c->xAxis()->setLabelFormat("{value|dd/mm/yyyy}");

Hope this can help.

Regards
Peter Kwan

  Re: Default date format
Posted by RAJ on Oct-17-2018 05:07
Yes setFormatCondition looks very useful, there's a good example of it in use on "Zooming and Scrolling with Track Line" page. Thanks.