开发者

How to Force a Flex Chart to Redraw During Runtime

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?

开发者_C百科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);
        }   
    }


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

Example:

ArrayCollection arr.refresh ();

XML char.dataprovider = xmlData

regars

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜