Flex 4 - DateTimeAxis label bug
When using "months" as the calculated labelUnit, without inversion, DateTimeAxis sets incorrect positions for the labels. This results in scale being set to 0 and therefore no labels being displayed. I copied the code that causes the problem below: (notice uninverted acts the same as inverted)
in DateTimeAxis
if(direction == "inverted")
labelCache.push(new AxisLabel(
1 - (dTime - computedMinimum) / r, new Date(dTime),
lfunc(labelDate, previousValue, this)));
else
labelCache.push(new AxisLabel(
1 - (dTime - computedMinimum) / r, new Date(dTime),
lfunc(labelDate, previousValue, this)));
Any word on a fix? Is this a known issue? In the meantime, we subclassed and overrode the function. Our fixed code is:
override protected function buildLabelCache():Boolean{
if(super.buildLabelCache()){
var r:Number = computedMaximum - computedMinimum - new DateRangeUtilities().calculateDisabledRange(computedMinimum, computedMaximum);
for each(var label:AxisLabel in labelCache){
label.position = ((label.value as Date).time - computedMinimum) / r;
}
return true;
}else{
return false;
}
}
tsk tsk on the copy paste error 😉
