How to make Flex diagram redraw at runtime

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

I have a function that sets various properties after creating a chart. There I tried it all:

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

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

MXML Code for Axis:

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

Tag Function:

  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); } } 
+4
source share
1 answer

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

Example:

ArrayCollection arr.refresh ();

XML char.dataprovider = xmlData p>

regars

0
source

Source: https://habr.com/ru/post/1304960/


All Articles