5

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);
        }   
    }
Ivan
  • 89
  • 9
  • normally it will work If you reassign "verticalAxis.labelFunction=vAxisFormat" on that button click. – manjs Oct 23 '13 at 07:41

1 Answers1

0

Try updating the data provider. This redraws the graph, so all the components.

Example:

ArrayCollection arr.refresh ();

XML char.dataprovider = xmlData

regars

matilu
  • 276
  • 2
  • 8