tags:

views:

278

answers:

0

I have a column chart that uses a label function to format the vertical axis. I added a button and want the axis (or chart) to redraw when the button is clicked. Right now, the chart axis renders OK only when initially added to the view state.

I have a function that sets various properties after the chart is initially created. In there, I have tried all these:

myChart.verticalAxis.dataChanged();
myChart.validateNow();
myChart.validateDisplayList();
myChart.validateProperties();
myChart.invalidateDisplayList();
myChart.invalidateProperties();

But they do not change the axis formatting. How can I do this?

The MXML code for the axis is:

< mx:LinearAxis id="verticalAxis" labelFunction="vAxisFormat"/>

The label function is:

    private function vAxisFormat(labelValue:Number, previousValue:Object, axis:IAxis):String {
        axis.getLabelEstimate();
        if (_scale == 1){
            return currencyFormatter.format(labelValue/_scale); 
        }else {
            return numberFormatter.format(labelValue/_scale);
        }   
    }