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

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);
        }  
    }

I found out that the Adobe help has
the following method for the Formatter class:

resourcesChanged(): This method is called when a Formatter is constructed, and 
again whenever the ResourceManager dispatches a "change" Event to indicate that 
the localized resources have changed in some way.

This event will be dispatched when you set the ResourceManager's localeChain 
property, when a resource module has finished loading, and when you call the 
ResourceManager's update() method. Subclasses should override this method and, 
after calling super.resourcesChanged(), do whatever is appropriate in response
to having new resource values.

So I inserted this with great expectations:
resourceManager.update();

That didn't work so I tried:

resourceManager.dispatchEvent(new Event("Change"));

What am I missing? How do I call the axis format label function or get the 
chart to redraw?

Reply via email to