27 December 2010

Escape the American date format in DateTimeAxis Flex charts using the <mx:DateTimeAxis> are hardcoded with the American date format. As only 6% of the world's population is using this date format, I've seen more than one request for something like this: As the <mx:DateTimeAxis> has the label formats hardcoded, one solution is to extend it. The class <mx:DateTimeAxis> contains various functions for every type of time units, e.g formatYears(), formatMonths(), formatDays(), formatMinutes(), formatSeconds() and formatMilliseconds(). The <chart:FormattedDateTimeAxis> class above overrides the date functions, and allows custom formats with the properties formatStringYears, formatStringMonths and formatStringDays. The benefit with this approach is that we utilise all the logic within <mx:DateTimeAxis>, but only overriding the formatting part.

Labels: , ,