2 Replies Latest reply on Jan 18, 2012 4:32 AM by ashish.gd

    Flex SDK 4, bug in mx.charts.AxisRenderer with lastLabel==null?




      I'm upgrading a Flex application from SDK 3.5 to 4.1.

      I have a problem with mx.charts.AreaChart, namely with it's horizontal AxisRenderer for DateTimeAxis.

      During layouting one of its internal variable (lastLabel in calcRotationAndSpacing() method) can become null, causing Null pointer error.


      From examining the source code it looks like the problem happens in calcRotationAndSpacing() when there is just one label (didn't examine yet why, but presumably for small regions and narrow datasets that may happen, though it may be a bug generating labels), canDropLabels==true, then at line 1814:


         lastLabel = _labels[maxSkipCount + 1];


      Even though maxSkipCount==0, _labels[] array has nothing at index 1, returning null.


      In SDK 3 the label was calculated differently:


         lastLabel = _labels[_labels.length - 1];       


      always returning at least the first label.


      I can build a sample app, but to save time would like to know first if anybody had this before, and if isn't that an obvious bug?

      Later code has no graceful handler for when lastLabel==null


      Thanks, Andrei.