Wednesday, January 27, 2010

Flex -- Problem with LinearAxis

Error messages were popping up when I hovered my mouse over a chart.  I discovered that this was due to a bug (or just poor coding) in NumericAxis.  The formatDataTip function in the series was calling the formatForScreen function in NumericAxis.  This function calls toString on whatever object gets passed in.  If  the object is null (as it could be if a data point is missing), a null pointer exception will result.  The easy solution was to extend NumericAxis and override the formatForScreen function:


    public override function formatForScreen(value:Object):String {
        
        if(value == null){
            return "";
        }

        return value.toString();
    }

No comments:

Post a Comment