Skip to main content
Jun 21, 2010 5:49 PM UTC
Question

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  😉

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Participant
Jul 7, 2010 10:19 AM UTC

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...

Translate