Skip to main content
June 21, 2010
Question

Flex 4 - DateTimeAxis label bug

  • June 21, 2010
  • 1 reply
  • 1549 views

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  😉

This topic has been closed for replies.

1 reply

Participant
July 7, 2010

Hi,

At least, the duplicated code is a known issue, see https://bugs.adobe.com/jira/browse/FLEXDMV-2231.

The issue describe a wrong position computation which leads to reverse order labels. The recommended workaround is to add a "disabledDays = [ ]".

This may also work for your issue...